<?php

namespace Signteer\Core\Event\Volunteer;

use Signteer\Core\Event\StorableEventInterface;

final class VolunteerCreated implements StorableEventInterface
{
    private int $id;
    private string $title;
    private string $email;
    private string $phone;

    public function __construct(int $id, string $title, string $email, string $phone)
    {
        $this->id = $id;
        $this->title = $title;
        $this->email = $email;
        $this->phone = $phone;
    }

    public function getId(): int
    {
        return $this->id;
    }

    public static function alias(): string
    {
        return 'volunteer-created';
    }

    public function toArray(): array
    {
        return ['id' => $this->id, 'title' => $this->title, 'email' => $this->email, 'phone' => $this->phone];
    }

    public static function fromArray(array $a)
    {
        return new self($a['id'], $a['title'], $a['email'], $a['phone']);
    }
}
