<?php

declare(strict_types=1);

/*
 * Chill is a software for social workers
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 */

namespace Chill\PersonBundle\Actions\PersonEdit;

use Chill\MainBundle\Entity\Civility;
use Chill\MainBundle\Entity\Country;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\MainBundle\Entity\Gender;
use Chill\MainBundle\Entity\Language;
use Chill\PersonBundle\Entity\AdministrativeStatus;
use Chill\PersonBundle\Entity\EmploymentStatus;
use Chill\PersonBundle\Entity\Identifier\PersonIdentifier;
use Chill\PersonBundle\Entity\MaritalStatus;
use Chill\PersonBundle\Entity\PersonAltName;
use Chill\PersonBundle\Validator\Constraints\Person\Birthdate;
use Doctrine\Common\Collections\Collection;
use libphonenumber\PhoneNumber;
use Misd\PhoneNumberBundle\Validator\Constraints\PhoneNumber as MisdPhoneNumberConstraint;
use Symfony\Component\Validator\Constraints as Assert;

class PersonEditDTO
{
    #[Assert\NotBlank(message: 'The firstname cannot be empty')]
    #[Assert\Length(max: 255)]
    public string $firstName;

    #[Assert\NotBlank(message: 'The lastname cannot be empty')]
    #[Assert\Length(max: 255)]
    public string $lastName;

    #[Birthdate]
    public ?\DateTime $birthdate = null;

    #[Assert\GreaterThanOrEqual(propertyPath: 'birthdate')]
    #[Assert\LessThanOrEqual('today')]
    public ?\DateTimeImmutable $deathdate = null;

    #[Assert\NotNull(message: 'The gender must be set')]
    public ?Gender $gender = null;

    #[Assert\Valid]
    public CommentEmbeddable $genderComment;

    public ?int $numberOfChildren = null;

    /**
     * @var array<string, PersonAltName> where the key is the altname's key
     */
    public array $altNames = [];

    public string $memo = '';

    public ?EmploymentStatus $employmentStatus = null;

    public ?AdministrativeStatus $administrativeStatus = null;

    public string $placeOfBirth = '';

    public ?string $contactInfo = '';

    #[MisdPhoneNumberConstraint(type: [MisdPhoneNumberConstraint::FIXED_LINE, MisdPhoneNumberConstraint::VOIP, MisdPhoneNumberConstraint::PERSONAL_NUMBER])]
    public ?PhoneNumber $phonenumber = null;

    #[MisdPhoneNumberConstraint(type: [MisdPhoneNumberConstraint::MOBILE])]
    public ?PhoneNumber $mobilenumber = null;

    public ?bool $acceptSms = false;

    #[Assert\Valid(traverse: true)]
    public Collection $otherPhonenumbers; // Collection<int, \Chill\PersonBundle\Entity\PersonPhone>

    #[Assert\Email]
    public ?string $email = '';

    public ?bool $acceptEmail = false;

    public ?Country $countryOfBirth = null;

    public ?Country $nationality = null;

    public Collection $spokenLanguages; // Collection<int, Language>

    public ?Civility $civility = null;

    public ?MaritalStatus $maritalStatus = null;

    public ?\DateTimeInterface $maritalStatusDate = null;

    #[Assert\Valid]
    public CommentEmbeddable $maritalStatusComment;

    public ?array $cFData = null;

    /**
     * @var array<string, PersonIdentifier>
     */
    #[Assert\Valid(traverse: true)]
    public array $identifiers = [];
}
