<?php

namespace App\Entity;

use App\Enums\GenderType;
use App\Enums\RaceType;
use App\Enums\RelationshipType;
use App\Repository\MemberRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\Uid\Uuid;

#[ORM\Entity(repositoryClass: MemberRepository::class)]
#[ORM\Table(name: '`member`')]
class Member
{
    #[ORM\Id]
    #[ORM\Column(type: UuidType::NAME, unique: true)]
    #[ORM\GeneratedValue(strategy: 'CUSTOM')]
    #[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
    private ?Uuid $id = null;

    #[ORM\ManyToOne(inversedBy: 'members')]
    #[ORM\JoinColumn(nullable: false)]
    private ?MemberCase $memberCase = null;

    #[ORM\Column(length: 45)]
    private ?string $lastName = null;

    #[ORM\Column(length: 45)]
    private ?string $firstName = null;

    #[ORM\Column(length: 45, nullable: true)]
    private ?RelationshipType $relationship = null;

    #[ORM\Column(length: 45, nullable: true)]
    private ?string $personalId = null;

    #[ORM\Column(nullable: true, enumType: GenderType::class)]
    private ?GenderType $gender = null;

    #[ORM\Column(length: 45, nullable: true)]
    private ?RaceType $race = null;

    #[ORM\Column(type: Types::DATE_MUTABLE)]
    private ?\DateTimeInterface $dob = null;

    #[ORM\Column(length: 45, nullable: true)]
    private ?string $language = null;

    #[ORM\Column(length: 45, nullable: true)]
    private ?string $emergencyContact = null;

    #[ORM\Column(length: 15, nullable: true)]
    private ?string $phone = null;

    #[ORM\Column(length: 15, nullable: true)]
    private ?string $dayPhone = null;

    #[ORM\Column(length: 15, nullable: true)]
    private ?string $eveningPhone = null;

    #[ORM\Column(length: 15, nullable: true)]
    private ?string $cellPhone = null;

    #[ORM\Column(length: 45, nullable: true)]
    private ?string $email = null;

    #[ORM\Column(length: 255, nullable: true)]
    private ?string $school = null;

    #[ORM\Column(length: 64, nullable: true)]
    private ?string $address = null;

    #[ORM\Column(length: 45, nullable: true)]
    private ?string $city = null;

    #[ORM\Column(length: 15, nullable: true)]
    private ?string $state = null;

    #[ORM\Column(length: 10, nullable: true)]
    private ?string $zip = null;

    #[ORM\Column(length: 45, nullable: true)]
    private ?string $maritalStatus = null;

    #[ORM\Column]
    private ?bool $isChild = null;

    #[ORM\Column]
    private ?bool $isParent = null;

    #[ORM\Column]
    private ?bool $isAdultChild = null;

    #[ORM\Column]
    private ?bool $isLegalGuardian = null;

    #[ORM\Column]
    private ?bool $parentsLiveTogether = null;

    #[ORM\Column]
    private ?bool $dcsApproved = null;

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

    public function getCaseId(): ?MemberCase
    {
        return $this->memberCase;
    }

    public function setCaseId(?MemberCase $caseId): static
    {
        $this->memberCase = $caseId;

        return $this;
    }

    public function getLastName(): ?string
    {
        return $this->lastName;
    }

    public function setLastName(string $lastName): static
    {
        $this->lastName = $lastName;

        return $this;
    }

    public function getFirstName(): ?string
    {
        return $this->firstName;
    }

    public function setFirstName(string $firstName): static
    {
        $this->firstName = $firstName;

        return $this;
    }

    public function getName(): string
    {
        return "{$this->firstName} {$this->lastName}";
    }

    public function getRelationship(): ?RelationshipType
    {
        return $this->relationship;
    }

    public function setRelationship(?RelationshipType $relationship): static
    {
        $this->relationship = $relationship;

        return $this;
    }

    public function getPersonalId(): ?string
    {
        return $this->personalId;
    }

    public function setPersonalId(?string $personalId): static
    {
        $this->personalId = $personalId;

        return $this;
    }

    public function getGender(): ?GenderType
    {
        return $this->gender;
    }

    public function setGender(?GenderType $gender): static
    {
        $this->gender = $gender;

        return $this;
    }

    public function getRace(): ?RaceType
    {
        return $this->race;
    }

    public function setRace(?RaceType $race): static
    {
        $this->race = $race;

        return $this;
    }

    public function getDob(): ?\DateTimeInterface
    {
        return $this->dob;
    }

    public function setDob(\DateTimeInterface $dob): static
    {
        $this->dob = $dob;

        return $this;
    }

    public function getLanguage(): ?string
    {
        return $this->language;
    }

    public function setLanguage(?string $language): static
    {
        $this->language = $language;

        return $this;
    }

    public function getEmergencyContact(): ?string
    {
        return $this->emergencyContact;
    }

    public function setEmergencyContact(?string $emergencyContact): static
    {
        $this->emergencyContact = $emergencyContact;

        return $this;
    }

    public function getFormattedPhone(): ?string
    {
        if ($this->phone) {
            return '(' . substr($this->phone, 0, 3) . ') ' . substr($this->phone, 3, 3) . '-' . substr($this->phone, 6);
        } elseif ($this->dayPhone) {
            return '(' . substr($this->dayPhone, 0, 3) . ') ' . substr($this->dayPhone, 3, 3) . '-' . substr($this->dayPhone, 6);
        } elseif ($this->eveningPhone) {
            return '(' . substr($this->eveningPhone, 0, 3) . ') ' . substr($this->eveningPhone, 3, 3) . '-' . substr($this->eveningPhone, 6);
        } elseif ($this->cellPhone) {
            return '(' . substr($this->cellPhone, 0, 3) . ') ' . substr($this->cellPhone, 3, 3) . '-' . substr($this->cellPhone, 6);
        }

        return null;
    }

    public function getPhone(): ?string
    {
        return $this->phone;
    }

    public function setPhone(?string $phone): static
    {
        $this->phone = $phone;

        return $this;
    }

    public function getDayPhone(): ?string
    {
        return $this->dayPhone;
    }

    public function setDayPhone(?string $dayPhone): static
    {
        $this->dayPhone = $dayPhone;

        return $this;
    }

    public function getEveningPhone(): ?string
    {
        return $this->eveningPhone;
    }

    public function setEveningPhone(?string $eveningPhone): static
    {
        $this->eveningPhone = $eveningPhone;

        return $this;
    }

    public function getCellPhone(): ?string
    {
        return $this->cellPhone;
    }

    public function setCellPhone(?string $cellPhone): static
    {
        $this->cellPhone = $cellPhone;

        return $this;
    }

    public function getEmail(): ?string
    {
        return $this->email;
    }

    public function setEmail(?string $email): static
    {
        $this->email = $email;

        return $this;
    }

    public function getSchool(): ?string
    {
        return $this->school;
    }

    public function setSchool(?string $school): static
    {
        $this->school = $school;

        return $this;
    }

    public function getAddress(): ?string
    {
        return $this->address;
    }

    public function setAddress(?string $address): static
    {
        $this->address = $address;

        return $this;
    }

    public function getCity(): ?string
    {
        return $this->city;
    }

    public function setCity(?string $city): static
    {
        $this->city = $city;

        return $this;
    }

    public function getState(): ?string
    {
        return $this->state;
    }

    public function setState(?string $state): static
    {
        $this->state = $state;

        return $this;
    }

    public function getZip(): ?string
    {
        return $this->zip;
    }

    public function setZip(?string $zip): static
    {
        $this->zip = $zip;

        return $this;
    }

    public function getMaritalStatus(): ?string
    {
        return $this->maritalStatus;
    }

    public function setMaritalStatus(?string $maritalStatus): static
    {
        $this->maritalStatus = $maritalStatus;

        return $this;
    }

    public function isChild(): ?bool
    {
        return $this->isChild;
    }

    public function setChild(bool $isChild): static
    {
        $this->isChild = $isChild;

        return $this;
    }

    public function isParent(): ?bool
    {
        return $this->isParent;
    }

    public function setParent(bool $isParent): static
    {
        $this->isParent = $isParent;

        return $this;
    }

    public function isAdultChild(): ?bool
    {
        return $this->isAdultChild;
    }

    public function setAdultChild(bool $isAdultChild): static
    {
        $this->isAdultChild = $isAdultChild;

        return $this;
    }

    public function isLegalGuardian(): ?bool
    {
        return $this->isLegalGuardian;
    }

    public function setLegalGuardian(bool $isLegalGuardian): static
    {
        $this->isLegalGuardian = $isLegalGuardian;

        return $this;
    }

    public function isParentsLiveTogether(): ?bool
    {
        return $this->parentsLiveTogether;
    }

    public function setParentsLiveTogether(bool $parentsLiveTogether): static
    {
        $this->parentsLiveTogether = $parentsLiveTogether;

        return $this;
    }

    public function isDcsApproved(): ?bool
    {
        return $this->dcsApproved;
    }

    public function setDcsApproved(bool $dcsApproved): static
    {
        $this->dcsApproved = $dcsApproved;

        return $this;
    }
}
