<?php

namespace AppBundle\Entity\Person;

use AppBundle\Annotation\ExportSplitFields;
use AppBundle\Entity\AccessAndFunction\Access;
use AppBundle\Entity\AccessWish\DocumentWish;
use AppBundle\Entity\Core\ContactPoint;
use AppBundle\Entity\Core\File;
use AppBundle\Enum\Core\AddressPostalTypeEnum;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Dunglas\ApiBundle\Annotation\Iri;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
use AppBundle\Entity\Core\Country;
use AppBundle\Entity\Traits\TimestampableEntity;
use AppBundle\Entity\Traits\CreatorUpdaterEntity;
use AppBundle\Entity\Bank\BankAccount;
use FOS\UserBundle\Model\User as BaseUser;
use AppBundle\Entity\Traits\AddressPostalType;
use AppBundle\Annotation\Confidentiality;
use AppBundle\Entity\Traits\ContactPointType;
use AppBundle\Entity\Core\ContactInterface;

/**
 * Personne physique ou morale
 *
 * @Iri("http://schema.org/Person")
 */
#[ORM\Entity(repositoryClass: 'AppBundle\Entity\Person\Repository\PersonRepository')]
class Person extends BaseUser implements ContactInterface
{
    use TimestampableEntity;
    use CreatorUpdaterEntity;
    use AddressPostalType;
    use ContactPointType;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups(['person', 'access_details', 'access_mass', 'access_reference', 'all_accesses_list', 'student_list', 'guardians_list', 'teachers_list', 'adherent_list', 'personnels_list', 'morals_list', 'ca_list', 'accesses_list', 'rule', 'access_details_billingpayers', 'equipment_list_supplier', 'equipment_list_access', 'equipmentrent_list_borrower', 'equipmentloan_list_borrower', 'equipmentcontrol_list_accompanist', 'equipmentcontrol_list_equipment', 'equipmentrepair_list_provider', 'equipmentaccounting_list_supplier', 'equipmentmediatheque_list_supplier', 'equipmentcostume_list_access', 'message_list_author', 'messagesend_list_author', 'template_list_author', 'othercontact_list', 'commission_list_commissionmembers', 'attendancebooking_list_access', 'donor_list_access', 'examenconvocation_list_student', 'medal_list_access', 'viewaudit_list_createdby', 'viewaudit_list_updatedby', 'my_student_list_access', 'planning_list', 'report_card', 'student_registration', 'student_registration_accessfamily', 'access_informations_edit', 'access_informations_edit_familymembers', 'equipment_details_editor', 'accesses_list_guardians', 'student_list_courses', 'adherent_list_guardians', 'access_duplicate_control_list', 'own_access', 'own_student_access', 'accesscmfnetwork', 'board_list', 'licence_cmf', 'networkmanagers_list', 'my_access_put', 'adherent_contact', 'access_mail', 'accesses_rules', 'payer_list', 'equipmentmediatheque_list_access', 'sepa_debit_mandate', 'cotisation_responsibles_accesses', 'fusion_accesses', 'accessbilling_edit', 'view_from_manager_create', 'online_registration_access_details', 'access_files', 'accesses_no_reregistred_list', 'cmf_network_persons'])]
    protected $id;
    /**
     * @var string The username of the author.
     */
    #[ORM\Column(type: 'string', length: 255, nullable: true, unique: true)]
    #[Groups(['person', 'access_details_person', 'organization_create_access', 'student_list_person', 'guardians_list_person', 'accesses_list_person', 'adherent_list_person', 'board_list_person', 'ca_list_person', 'othercontact_list_person', 'personnels_list_person', 'teachers_list_person', 'all_accesses_list_person', 'payer_list_person'])]
    protected $username;
    /**
     * @var string The username of the author.
     */
    #[ORM\Column(name: 'username_canonical', type: 'string', length: 255, nullable: true, unique: true)]
    protected $usernameCanonical;
    /**
     * @var string The email of the user.
     *
     */
    #[ORM\Column(type: 'string', length: 255, nullable: true)]
    #[Groups(['person'])]
    protected $email;
    /**
     * @var string The email of the user.
     */
    #[ORM\Column(name: 'email_canonical', type: 'string', length: 255, nullable: true)]
    protected $emailCanonical;
    /**
     * @var boolean
     */
    #[ORM\Column(type: 'boolean', options: ['default' => false])]
    #[Groups(['organization_create', 'all_accesses_list_person'])]
    protected $enabled = false;
    /**
     * The salt to use for hashing
     *
     * @var string
     */
    #[ORM\Column(type: 'string', options: ['default' => ''])]
    #[Groups(['organization_create'])]
    protected $salt;
    /**
     * Encrypted password. Must be persisted.
     *
     * @var string
     *
     */
    #[ORM\Column(type: 'string', nullable: true)]
    #[Groups(['organization_create', 'organization_create_access'])]
    protected $password;
    /**
     * @var \DateTime
     */
    #[ORM\Column(name: 'last_login', type: 'datetime', nullable: true)]
    protected $lastLogin;
    /**
     * Random string sent to the user email address in order to verify it
     *
     * @var string
     */
    #[ORM\Column(name: 'confirmation_token', type: 'string', nullable: true)]
    #[Groups(['person'])]
    protected $confirmationToken;
    /**
     * @var \DateTime
     */
    #[ORM\Column(name: 'password_requested_at', type: 'datetime', nullable: true)]
    protected $passwordRequestedAt;
    /**
     * @var boolean
     */
    #[ORM\Column(type: 'boolean', options: ['default' => false])]
    protected $locked = false;
    /**
     * @var boolean
     */
    #[ORM\Column(type: 'boolean', options: ['default' => false])]
    protected $expired = false;
    /**
     * @var \DateTime
     */
    #[ORM\Column(name: 'expires_at', type: 'datetime', nullable: true)]
    public $expiresAt;
    /**
     * @var array
     */
    #[ORM\Column(type: 'array')]
    protected $roles;
    /**
     * @var boolean
     */
    #[ORM\Column(name: 'credentials_expired', type: 'boolean', options: ['default' => false])]
    protected $credentialsExpired = false;
    /**
     * @var \DateTime
     */
    #[ORM\Column(name: 'credentials_expire_at', type: 'datetime', nullable: true)]
    protected $credentialsExpireAt;
    /**
     * @var ArrayCollection<PersonAddressPostal>
     */
    #[Assert\Valid]
    #[Groups(['person_personaddresspostal', 'all_accesses_list_person', 'access_details_person', 'morals_list_person', 'report_card_person', 'report_card_guardians', 'access_details_guardians', 'student_registration_person', 'student_registration_guardians', 'accesses_list_person', 'student_list_person', 'education_student_next_year_access', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'ca_list_person', 'othercontact_list_person', 'access_duplicate_control_list_person', 'board_list_person', 'networkmanagers_list_person', 'payer_list_person', 'sepa_debit_mandate_person', 'student_list_guardians', 'equipment_availability_form_borrower', 'view_from_manager_create_person', 'online_registration_access_details_person', 'build_bills_access'])]
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Person\PersonAddressPostal', mappedBy: 'person', orphanRemoval: true, cascade: ['persist'])]
    private $personAddressPostal;
    /**
     * @var ArrayCollection<PersonAddressPostal>
     */
    #[Groups(['template'])]
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Person\PersonAddressPostal', mappedBy: 'person', orphanRemoval: true, cascade: ['persist'], fetch: 'EXTRA_LAZY')]
    private $personAddressPostalPrincipal;
    #[Assert\Valid]
    #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\ContactPoint', cascade: ['persist'], orphanRemoval: true, inversedBy: 'person')]
    #[ORM\JoinTable(joinColumns: [], inverseJoinColumns: [])]
    #[ORM\JoinColumn(name: 'person_id', referencedColumnName: 'id')]
    #[ORM\JoinColumn(name: 'contactPoint_id', referencedColumnName: 'id')]
    #[Groups(['all_accesses_list_person', 'person_contactpoint', 'access_details_person', 'access_details_guardians', 'student_list_person', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'morals_list_person', 'ca_list_person', 'accesses_list_person', 'othercontact_list_person', 'report_card_person', 'report_card_guardians', 'student_registration_person', 'student_registration_guardians', 'access_informations_edit_familymembers', 'board_list_person', 'networkmanagers_list_person', 'network_list_adminaccess', 'adherent_contact_person', 'adherent_contact_guardians', 'access_mail_person', 'student_list_guardians', 'access_mail_guardians', 'payer_list_person', 'access_duplicate_control_list_person', 'view_from_manager_create_person', 'online_registration_access_details_person', 'accesses_no_reregistred_list_person', 'accesses_no_reregistred_list_guardians'])]
    private $contactPoint;
    #[Assert\Valid]
    #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Bank\BankAccount', inversedBy: 'person', cascade: ['persist'], orphanRemoval: true)]
    #[ORM\JoinTable(joinColumns: [], inverseJoinColumns: [])]
    #[ORM\JoinColumn(name: 'person_id', referencedColumnName: 'id')]
    #[ORM\JoinColumn(name: 'bankAccount_id', referencedColumnName: 'id')]
    #[Groups(['person_bankaccount', 'access_details_person', 'sepa_debit_mandate_person', 'build_bills_access'])]
    private $bankAccount;
    /**
     * @var File An image of the item. This can be a [URL](http://schema.org/URL) or a fully described [ImageObject](http://schema.org/ImageObject).
     *
     * @Iri("https://schema.org/image")
     * @Confidentiality(visibility=\AppBundle\Enum\Confidentiality\ConfidentialityTypeEnum::VISIBILITY_ORGANIZATION)
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Core\File', inversedBy: 'personImages')]
    #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
    #[Groups(['person', 'access_details_person', 'adherent_list_person', 'ca_list_person', 'student_registration_person', 'student_registration_guardians', 'student_registration_accessfamily', 'access_details_organization', 'access_informations_edit_person', 'accesses_list_person', 'student_list_person', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'morals_list_person', 'ca_list_person', 'othercontact_list_person', 'board_list_person', 'all_accesses_list_person', 'licence_cmf_person', 'networkmanagers_list_person', 'own_access_person', 'own_student_access_person', 'adherent_contact_person', 'access_details_children', 'online_registration_access_details_person'])]
    private $image;
    /**
     * @var \DateTime Date of birth.
     *
     * @Iri("https://schema.org/birthDate")
     */
    #[ORM\Column(type: 'date', nullable: true)]
    #[Assert\Date(message: 'invalid-date')]
    #[Groups(['person', 'access_details_person', 'student_list_person', 'rule_person', 'student_registration_person', 'student_registration_guardians', 'access_informations_edit_person', 'accesses_list_person', 'student_list_person', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'ca_list_person', 'othercontact_list_person', 'own_access_person', 'own_student_access_person', 'board_list_person', 'access_duplicate_control_list_person', 'fusion_accesses_person', 'online_registration_access_details_person', 'education_student_next_year_access'])]
    private $birthDate;
    /**
     * @var string Gender of the person.
     */
    #[ORM\Column(type: 'string', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Assert\Choice(callback: ['\AppBundle\Enum\Person\GenderEnum', 'toArray'], message: 'invalid-choice')]
    #[Groups(['person', 'access_details_person', 'adherent_list_person', 'ca_list_person', 'rule_person', 'accesses_list_person', 'student_list_person', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'othercontact_list_person', 'report_card_person', 'report_card_guardians', 'report_card_educationstudent', 'student_registration_person', 'student_registration_guardians', 'access_informations_edit_person', 'board_list_person', 'licence_cmf_person', 'networkmanagers_list_person', 'own_access_person', 'adherent_contact_person', 'accesses_rules_person', 'payer_list_person', 'access_duplicate_control_list_person', 'access_details_children', 'student_list_guardians', 'fusion_accesses_person', 'all_accesses_list_person', 'equipment_availability_form_borrower', 'education_student_next_year_access', 'online_registration_access_details_person', 'accesses_no_reregistred_list_person', 'build_bills_access'])]
    private $gender;
    /**
     * @var Country Nationality of the person.
     *
     * @Iri("https://schema.org/nationality")
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Core\Country')]
    #[Groups(['person', 'student_registration_person', 'student_registration_guardians', 'access_informations_edit_person', 'accesses_list_person', 'student_list_person', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'ca_list_person', 'othercontact_list_person', 'board_list_person', 'fusion_accesses_person'])]
    private $nationality;
    /**
     * @var string The place where the person was born.
     *
     * @Iri("https://schema.org/birthPlace")
     */
    #[ORM\Column(type: 'string', length: 50, nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['person', 'student_registration_person', 'accesses_list_person', 'access_informations_edit_person', 'student_list_person', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'ca_list_person', 'othercontact_list_person', 'board_list_person', 'own_access_person', 'own_student_access_person'])]
    private $birthPlace;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Assert\Choice(callback: ['\AppBundle\Enum\Person\InseeEnum', 'toArray'])]
    #[Groups(['person', 'access_mass_person', 'access_informations_edit_person', 'accesses_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'student_registration_person', 'fusion_accesses_person'])]
    private $insee;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['person', 'access_informations_edit_person'])]
    private $website;
    /**
     * @var string Given name. In the U.S., the first name of a Person. This can be used along with name instead of the name property.
     *
     * @Iri("https://schema.org/givenName")
     * @Confidentiality(visibility=\AppBundle\Enum\Confidentiality\ConfidentialityTypeEnum::VISIBILITY_ORGANIZATION)
     */
    #[ORM\Column(type: 'string', length: 50, nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Assert\Length(max: 50, maxMessage: 'invalid-max-length')]
    #[Groups(['person', 'template', 'access_reference_person', 'student_list_guardians', 'student_list_person', 'access_details_person', 'access_details_guardians', 'access_details_children', 'access_details_companyperson', 'access_details_accessfamily', 'guardians_list_person', 'teachers_list_person', 'student_list_person', 'adherent_list_person', 'personnels_list_person', 'ca_list_person', 'accesses_list_person', 'rule_person', 'access_details_billingpayers', 'billaccounting_list_billlines', 'equipmentaccounting_list_supplier', 'equipmentmediatheque_list_supplier', 'othercontact_list_person', 'donor_list_access', 'medal_list_access', 'viewaudit_list_updatedby', 'viewaudit_list_createdby', 'my_student_list_access', 'report_card_person', 'report_card_guardians', 'report_card_educationstudent', 'access_details_educationstudent', 'access_details_companypersonaccesses', 'student_registration_person', 'student_registration_guardians', 'student_registration_accessfamily', 'access_details_organization', 'access_informations_edit_person', 'equipment_details_editor', 'equipment_details_managercontrol', 'equipment_details_equipmentloanfiltered', 'student_list_courses', 'adherent_list_guardians', 'access_duplicate_control_list_person', 'event_details_organizer', 'board_list_person', 'event_details_eventuserfiltered', 'examen_details_convocation', 'examen_details_jury', 'course_details_organizer', 'course_details_students', 'educationalproject_details_silentpartner', 'educationalproject_details_billingreceivers', 'educationalproject_details_organizer', 'licence_cmf_person', 'networkmanagers_list_person', 'educationstudent_reference_access', 'educationstudent_reference_teachers', 'educationteacher_reference_teacher', 'adherent_contact_person', 'adherent_contact_guardians', 'own_access_person', 'access_details_accessfamily', 'accesses_rules_person', 'billpayment_list_bill', 'organization_details_organizationlicences', 'payer_list_person', 'payer_list_billingpayers', 'invitations_list_guest', 'all_accesses_list_person', 'event_details_eventuser', 'billcredit_list_access', 'equipment_list_equipmentloan', 'equipmentmediatheque_list_equipmentloan', 'equipmentcostume_list_equipmentloan', 'sepa_debit_mandate_person', 'cotisation_responsibles_accesses_person', 'fusion_accesses_person', 'equipment_availability_form_borrower', 'course_details_attendancebooking', 'examen_details_attendancebooking', 'educationalproject_details_attendancebooking', 'event_details_attendancebooking', 'equipment_availability_form_borrower', 'education_input_list_teachers', 'education_input_list_access', 'view_from_manager_create_person', 'bill_list_billlines', 'education_student_next_year_access', 'online_registration_access_details_person', 'access_intangible_list_access', 'accesses_no_reregistred_list_person', 'accessholidays_list_access', 'educationstudent_notation_access', 'email_detail_author', 'cmf_network_persons_person', 'build_bills_access', 'build_bills_billlines'])]
    private $givenName;
    /**
     * @var string The name of the item.
     *
     * @Confidentiality(visibility=\AppBundle\Enum\Confidentiality\ConfidentialityTypeEnum::VISIBILITY_ORGANIZATION)
     * @Iri("https://schema.org/name")
     */
    #[ORM\Column(type: 'string', length: 100, nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Assert\Length(max: 100, maxMessage: 'invalid-max-length')]
    #[Groups(['person', 'template', 'access_reference_person', 'morals_list_person', 'access_details_person', 'student_list_person', 'access_details_accessfamily', 'access_details_guardians', 'access_details_children', 'access_details_companyperson', 'access_details_accessfamily', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'ca_list_person', 'accesses_list_person', 'rule_person', 'access_details_billingpayers', 'billaccounting_list_billlines', 'equipment_list_supplier', 'equipmentaccounting_list_supplier', 'equipmentmediatheque_list_supplier', 'equipmentaccounting_list_supplier', 'equipmentmediatheque_list_supplier', 'othercontact_list_person', 'donor_list_access', 'equipmentcostume_list_access', 'medal_list_access', 'viewaudit_list_updatedby', 'viewaudit_list_createdby', 'my_student_list_access', 'report_card_person', 'report_card_guardians', 'report_card_educationstudent', 'access_details_educationstudent', 'access_details_companypersonaccesses', 'access_details_companypersoncompany', 'student_registration_person', 'student_registration_guardians', 'student_registration_accessfamily', 'access_details_organization', 'access_informations_edit_person', 'equipment_details_editor', 'equipment_details_supplier', 'educationstudent_notation_access', 'equipment_details_managercontrol', 'equipment_details_equipmentrepair', 'equipment_details_equipmentloanfiltered', 'student_list_courses', 'adherent_list_guardians', 'access_duplicate_control_list_person', 'event_details_organizer', 'board_list_person', 'event_details_eventuser', 'event_details_eventuserfiltered', 'examen_details_convocation', 'examen_details_jury', 'course_details_organizer', 'course_details_students', 'educationalproject_details_silentpartner', 'educationalproject_details_operationalpartner', 'educationalproject_details_financiers', 'educationalproject_details_billingreceivers', 'educationalproject_details_organizer', 'licence_cmf_person', 'networkmanagers_list_person', 'educationstudent_reference_access', 'educationstudent_reference_teachers', 'educationteacher_reference_teacher', 'adherent_contact_person', 'adherent_contact_guardians', 'own_access_person', 'access_details_accessfamily', 'equipmentmediatheque_list_editor', 'othercontact_list_companypersoncompany', 'accesses_rules_person', 'billpayment_list_bill', 'organization_details_organizationlicences', 'payer_list_person', 'all_accesses_list_person', 'payer_list_billingpayers', 'invitations_list_guest', 'event_details_eventuser', 'billcredit_list_access', 'student_list_guardians', 'equipment_list_equipmentloan', 'equipmentmediatheque_list_equipmentloan', 'equipmentcostume_list_equipmentloan', 'cotisation_responsibles_accesses_person', 'fusion_accesses_person', 'equipment_availability_form_borrower', 'course_details_attendancebooking', 'examen_details_attendancebooking', 'educationalproject_details_attendancebooking', 'event_details_attendancebooking', 'equipment_availability_form_borrower', 'education_input_list_access', 'education_input_list_teachers', 'view_from_manager_create_person', 'bill_list_billlines', 'education_student_next_year_access', 'online_registration_access_details_person', 'access_intangible_list_access', 'accesses_no_reregistred_list_person', 'accessholidays_list_access', 'email_detail_author', 'cmf_network_persons_person', 'build_bills_access', 'build_bills_billlines'])]
    private $name;
    /**
     * @var string
     *
     * @ExportSplitFields({"name","givenName"})
     */
    #[Groups(['person', 'message_list_author', 'messagesend_list_author', 'template_list_author', 'attendancebooking_list_access', 'bill_list_access', 'billaccounting_list_access', 'examenconvocation_list_student', 'guardians_list_children', 'commission_list_commissionmembers', 'morals_list_companypersonaccesses', 'student_list_guardians', 'placerepair_list_provider', 'equipmentcostume_list_access', 'equipmentcontrol_list_accompanist', 'equipmentcontrol_list_equipment', 'equipment_list_access', 'equipmentloan_list_borrower', 'equipmentrent_list_borrower', 'equipmentrepair_list_provider', 'presence_attendance_convocation', 'presence_attendance_students', 'presence_attendance_eventuser', 'accesses_list_guardians', 'adherent_list_guardians', 'equipment_details_equipmentloanfiltered', 'medal_list_access', 'attendance_list_access', 'attendance_list_replacement', 'donor_list_access', 'adherent_contact_guardians', 'student_list_educationstudent', 'billpayment_list_bill', 'educationnotation_list_educationstudent', 'planning_detail_organizer', 'planning_detail_students', 'planning_detail_attendancebooking', 'planning_detail_convocation', 'planning_detail_jury', 'payer_list_billingpayers', 'all_accesses_list_person', 'billcredit_list_access', 'invitations_list_guest', 'equipmentmediatheque_list_access', 'education_input_list_access', 'education_input_list_teachers', 'education_student_next_year_teachers', 'education_student_next_year_educationstudentlastyear', 'attendancebooking_list_course', 'access_intangible_list_access', 'billpayment_list_bill', 'accesses_no_reregistred_list_educationstudent', 'accesses_no_reregistred_list_guardians', 'worksbyusers_db_work', 'accessholidays_list_access', 'payer_list_person', 'accessholidays_list_access', 'advancepayment_list_access', 'billpayment_list_accessbillingaccountbalancereimbursement', 'educationstudent_notation_access'])]
    private $fullNameTemplate;
    /**
     * @var string
     * @ExportSplitFields({"gender","name","givenName","contactPoint.email","contactPoint.telphoneTemplate","contactPoint.mobilPhoneTemplate"})
     */
    #[Groups(['student_list_guardians', 'accesses_list_guardians', 'adherent_list_guardians', 'accesses_no_reregistred_list_guardians'])]
    private $fullNameAndContactTemplate;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Assert\Choice(callback: ['\AppBundle\Enum\Person\MoralPersonTypeEnum', 'toArray'])]
    #[Groups(['person', 'morals_list_person', 'access_informations_edit_person', 'access_details_person'])]
    private $typeMoral;
    /**
     * @var bool
     */
    #[ORM\Column(type: 'boolean', options: ['default' => true])]
    #[Assert\Type(type: 'boolean')]
    #[Assert\NotNull]
    #[Groups(['person', 'access_reference_person', 'access_details_person', 'access_informations_edit_person', 'donor_list_access', 'accessbilling_edit_person'])]
    private $isPhysical = true;
    /**
     * @var bool
     */
    #[ORM\Column(type: 'boolean', options: ['default' => true])]
    #[Assert\Type(type: 'boolean')]
    #[Assert\NotNull]
    #[Groups(['person', 'access_informations_edit_person', 'student_registration_person', 'accesses_list_person', 'access_mass_person', 'student_list_person', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'ca_list_person', 'othercontact_list_person', 'board_list_person', 'own_access_person', 'own_student_access_person', 'access_details_person', 'fusion_accesses_person', 'online_registration_access_details_person'])]
    private $imageRight = true;
    /**
     * @var array
     */
    #[ORM\Column(type: 'json_array')]
    #[Assert\Type(type: 'array')]
    #[Groups(['person', 'access_mass_person', 'access_details_person'])]
    private $confidentiality = array();
    /**
     * @var Medical
     */
    #[Assert\Valid]
    #[ORM\OneToOne(targetEntity: 'AppBundle\Entity\Person\Medical', inversedBy: 'person', cascade: ['persist'], fetch: 'EAGER')]
    #[ORM\JoinColumn(nullable: true)]
    #[Groups(['person', 'access_mass_person', 'access_details_person', 'access_details', 'student_registration_person', 'accesses_list_person', 'student_list_person', 'adherent_list_person', 'own_student_access_person', 'fusion_accesses_person', 'online_registration_access_details_person'])]
    private $medical;
    /**
     * @var ArrayCollection<Access>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', mappedBy: 'person', orphanRemoval: true)]
    #[Groups(['person_access'])]
    private $access;
    /**
     * @var ArrayCollection<File>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Core\File', mappedBy: 'person', orphanRemoval: true)]
    #[Groups(['person_file', 'access_details_person'])]
    private $files;
    /**
     * @var ArrayCollection<DisciplineOtherEstablishment>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Person\DisciplineOtherEstablishment', mappedBy: 'person', orphanRemoval: true, cascade: ['persist'])]
    #[Groups(['person_disciplineotherestablishment', 'access_details_person'])]
    private $disciplineotherestablishments;
    /**
     * @var ArrayCollection<Qualification>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Person\Qualification', mappedBy: 'person', orphanRemoval: true, cascade: ['persist'])]
    #[Groups(['person_qualification', 'access_informations_edit_person'])]
    private $qualifications;
    /**
     * @var ArrayCollection<SchoolingInEstablishment>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Person\SchoolingInEstablishment', mappedBy: 'person', orphanRemoval: true, cascade: ['persist'])]
    #[Groups(['person_schoolinginestablishment', 'access_details_person'])]
    private $schoolingEstablisments;
    /**
     * @var ArrayCollection<TeacherSchoolingHistory>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Person\TeacherSchoolingHistory', mappedBy: 'person', orphanRemoval: true, cascade: ['persist'])]
    #[Groups(['person_teacherschoolinghistory', 'access_details_person'])]
    private $teacherSchoolingHistories;
    /**
     * @var int
     */
    #[Groups(['template', 'student_list_person', 'guardians_list_person', 'personnels_list_person', 'othercontact_list_person', 'ca_list_person', 'adherent_list_person', 'accesses_list_person', 'teachers_list_person', 'board_list_person', 'education_student_next_year_access'])]
    protected $ageTemplate;
    /**
     * @var ArrayCollection|File[]
     */
    #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\File', mappedBy: 'accessPersons', cascade: ['persist'])]
    #[ORM\OrderBy(['id' => 'DESC'])]
    #[Groups(['person_files', 'access_files_person'])]
    private $personFiles;
    /**
     * @var ArrayCollection|File[]
     */
    #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\File', mappedBy: 'accessPersons', cascade: ['persist'], fetch: 'EXTRA_LAZY')]
    #[ORM\OrderBy(['id' => 'DESC'])]
    #[Groups(['access_details_person'])]
    private $personFilesFiltered;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer', nullable: true)]
    #[Groups(['my_access_put_person', 'own_access_person', 'access_details_person', 'person'])]
    private $accessFavorite = false;
    /**
     * @var \DateTime
     */
    #[ORM\Column(name: 'login_requested_at', type: 'datetime', nullable: true)]
    #[Groups(['person'])]
    private $loginRequestedAt;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string', length: 150, nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Assert\Length(max: 150, maxMessage: 'invalid-max-length')]
    #[Groups(['person', 'access_informations_edit_person'])]
    private $profession;
    /**
     * @var ArrayCollection<DocumentWish>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\AccessWish\DocumentWish', mappedBy: 'personOwner', cascade: ['persist'], orphanRemoval: true)]
    #[Groups(['person_documentwishes', 'access_files_person', 'student_registration_person'])]
    private $documentWishes;
    public function __construct()
    {
        parent::__construct();
        $this->contactPoint = new ArrayCollection();
        $this->bankAccount = new ArrayCollection();
        $this->personAddressPostal = new ArrayCollection();
        $this->access = new ArrayCollection();
        $this->files = new ArrayCollection();
        $this->disciplineotherestablishments = new ArrayCollection();
        $this->qualifications = new ArrayCollection();
        $this->schoolingEstablisments = new ArrayCollection();
        $this->teacherSchoolingHistories = new ArrayCollection();
        $this->documentWishes = new ArrayCollection();
    }
    public function __toString()
    {
        return parent::__toString(); // TODO: Change the autogenerated stub
    }
    /**
     * Sets id.
     *
     * @param int $id
     *
     * @return $this
     */
    public function setId($id)
    {
        $this->id = $id;
        $this->setLegacyId($id);

        return $this;
    }
    /**
     * Gets id.
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }
    /**
     * Sets birthDate.
     *
     * @param \DateTime $birthDate
     *
     * @return $this
     */
    public function setBirthDate(\DateTime $birthDate = null)
    {
        $this->birthDate = $birthDate;

        return $this;
    }
    /**
     * Gets birthDate.
     *
     * @return \DateTime
     */
    public function getBirthDate()
    {
        return $this->birthDate ? $this->birthDate->format('Y-m-d') : $this->birthDate;
    }
    /**
     * Sets gender.
     *
     * @param string $gender
     *
     * @return $this
     */
    public function setGender($gender)
    {
        $this->gender = $gender;

        return $this;
    }
    /**
     * Gets gender.
     *
     * @return string
     */
    public function getGender()
    {
        return $this->gender;
    }
    /**
     * Sets givenName.
     *
     * @param string $givenName
     *
     * @return $this
     */
    public function setGivenName($givenName)
    {
        $this->givenName = $givenName;

        return $this;
    }
    /**
     * Gets givenName.
     *
     * @return string
     */
    public function getGivenName()
    {
        return $this->givenName;
    }
    /**
     * Sets nationality.
     *
     * @param Country $nationality
     *
     * @return $this
     */
    public function setNationality(Country $nationality = null)
    {
        $this->nationality = $nationality;

        return $this;
    }
    /**
     * Gets nationality.
     *
     * @return Country
     */
    public function getNationality()
    {
        return $this->nationality;
    }
    /**
     * Sets birthPlace.
     *
     * @param string $birthPlace
     *
     * @return $this
     */
    public function setBirthPlace($birthPlace)
    {
        $this->birthPlace = $birthPlace;

        return $this;
    }
    /**
     * Gets birthPlace.
     *
     * @return string
     */
    public function getBirthPlace()
    {
        return $this->birthPlace;
    }
    /**
     * Sets insee.
     *
     * @param string $insee
     *
     * @return $this
     */
    public function setInsee($insee)
    {
        $this->insee = $insee;

        return $this;
    }
    /**
     * Gets insee.
     *
     * @return string
     */
    public function getInsee()
    {
        return $this->insee;
    }
    /**
     * Sets website.
     *
     * @param string $website
     *
     * @return $this
     */
    public function setWebsite($website)
    {
        $this->website = $website;

        return $this;
    }
    /**
     * Gets website.
     *
     * @return string
     */
    public function getWebsite()
    {
        return $this->website;
    }
    /**
     * Sets image.
     *
     * @param string $image
     *
     * @return $this
     */
    public function setImage($image)
    {
        $this->image = $image;

        return $this;
    }
    /**
     * Gets image.
     *
     * @return string
     */
    public function getImage()
    {
        return $this->image;
    }
    /**
     * Sets email.
     *
     * @param string $email
     *
     * @return $this
     */
    public function setEmail($email)
    {
        $this->email = $email;

        return $this;
    }
    /**
     * Gets email.
     *
     * @return string
     */
    public function getEmail()
    {
        return $this->email;
    }
    /**
     * Sets username.
     *
     * @param string $username
     *
     * @return $this
     */
    public function setUsername($username)
    {
        $this->username = $username;

        return $this;
    }
    /**
     * Gets username.
     *
     * @return string
     */
    public function getUsername()
    {
        return $this->username;
    }
    /**
     * Sets password.
     *
     * @param string $password
     *
     * @return $this
     */
    public function setPassword($password)
    {
        $this->password = $password;

        return $this;
    }
    /**
     * Gets password.
     *
     * @return string
     */
    public function getPassword()
    {
        return $this->password;
    }
    /**
     * Sets name.
     *
     * @param string $name
     *
     * @return $this
     */
    public function setName($name)
    {
        $this->name = $this->isPhysical ? strtoupper($name) : $name;

        return $this;
    }
    /**
     * Gets name.
     *
     * @return string
     */
    public function getName()
    {
        return $this->isPhysical ? strtoupper($this->name) : $this->name;
    }
    /**
     * Sets typeMoral.
     *
     * @param string $typeMoral
     *
     * @return $this
     */
    public function setTypeMoral($typeMoral)
    {
        $this->typeMoral = $typeMoral;

        return $this;
    }
    /**
     * Gets typeMoral.
     *
     * @return string
     */
    public function getTypeMoral()
    {
        return $this->typeMoral;
    }
    /**
     * Add personAddressPostal
     *
     * @param PersonAddressPostal $personAddressPostal
     * @return Person
     */
    public function addPersonAddressPostal(PersonAddressPostal $personAddressPostal)
    {
        $personAddressPostal->setPerson($this);
        $this->personAddressPostal[] = $personAddressPostal;
        return $this;
    }
    /**
     * Remove personAddressPostal
     *
     * @param PersonAddressPostal $personAddressPostal
     */
    public function removePersonAddressPostal(PersonAddressPostal $personAddressPostal)
    {
        $this->personAddressPostal->removeElement($personAddressPostal);
    }
    /**
     * Get personAddressPostal
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPersonAddressPostal()
    {
        return $this->personAddressPostal;
    }
    /**
     * Get personAddressPostal
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPersonAddressPostalPrincipal()
    {
        $principal = [];
        foreach ($this->personAddressPostal as $personAddressPostal){
            if($personAddressPostal->getType()  === AddressPostalTypeEnum::ADDRESS_PRINCIPAL){
                $principal = new ArrayCollection([$personAddressPostal]);
            }
        }
        return $principal;
    }
    /**
     * Add contact Point
     *
     * @param ContactPoint $contactPoint
     * @return Person
     */
    public function addContactPoint(ContactPoint $contactPoint)
    {
        $contactPoint->addPerson($this);
        $this->contactPoint[] = $contactPoint;
        return $this;
    }
    /**
     * Remove contact Point
     *
     * @param ContactPoint $contactPoint
     */
    public function removeContactPoint(ContactPoint $contactPoint)
    {
        $this->contactPoint->removeElement($contactPoint);
    }
    /**
     * Get contact Point
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getContactPoint()
    {
        return $this->contactPoint;
    }
    /**
     * Add bankAccount
     *
     * @param BankAccount $bankAccount
     * @return Person
     */
    public function addBankAccount(BankAccount $bankAccount)
    {
        $this->bankAccount[] = $bankAccount;
        $bankAccount->addPerson($this);
        return $this;
    }
    /**
     * Remove bankAccount
     *
     * @param BankAccount $bankAccount
     */
    public function removeBankAccount(BankAccount $bankAccount)
    {
        $this->bankAccount->removeElement($bankAccount);
    }
    /**
     * Get bankAccount
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getBankAccount()
    {
        return $this->bankAccount;
    }
    /**
     * Sets isPhysical.
     *
     * @param bool $isPhysical
     *
     * @return $this
     */
    public function setIsPhysical($isPhysical)
    {
        $this->isPhysical = $isPhysical;

        return $this;
    }
    /**
     * Gets isPhysical.
     *
     * @return bool
     */
    public function getIsPhysical()
    {
        return $this->isPhysical;
    }
    /**
     * Sets imageRight.
     *
     * @param bool $imageRight
     *
     * @return $this
     */
    public function setImageRight($imageRight)
    {
        $this->imageRight = $imageRight;

        return $this;
    }
    /**
     * Gets imageRight.
     *
     * @return bool
     */
    public function getImageRight()
    {
        return $this->imageRight;
    }
    /**
     * @return \DateTime
     */
    public function getCredentialsExpireAt()
    {
        return $this->credentialsExpireAt;
    }
    /**
     * @param \DateTime $credentialsExpireAt
     */
    public function setCredentialsExpireAt(\DateTime $credentialsExpireAt)
    {
        $this->credentialsExpireAt = $credentialsExpireAt;
        return $this;
    }
    /**
     * @return \DateTime
     */
    public function getExpiresAt()
    {
        return $this->expiresAt;
    }
    /**
     * @param \DateTime $expiresAt
     */
    public function setExpiresAt(\DateTime $expiresAt)
    {
        $this->expiresAt = $expiresAt;
        return $this;
    }
    public function setUsernameCanonical($usernameCanonical)
    {
        if (empty($usernameCanonical) || !isset($usernameCanonical))
            $this->usernameCanonical = NULL;
        else
            $this->usernameCanonical = $usernameCanonical;

        return $this;
    }
    public function getFullname()
    {
        return sprintf("%s %s", $this->getName(), $this->getGivenName());
    }
    /**
     * Get confidentiality
     *
     * @return array
     */
    public function getConfidentiality()
    {
        return $this->confidentiality ? $this->confidentiality : [];
    }
    /**
     * Set confidentiality
     *
     * @return Person
     */
    public function setConfidentiality(array $confidentiality)
    {
        $this->confidentiality = $confidentiality;

        return $this;
    }
    /**
     * Set medical
     *
     * @param \AppBundle\Entity\Person\Medical $medical
     *
     * @return Person
     */
    public function setMedical(\AppBundle\Entity\Person\Medical $medical = null)
    {
        $this->medical = $medical;

        return $this;
    }
    /**
     * Get medical
     *
     * @return \AppBundle\Entity\Person\Medical
     */
    public function getMedical()
    {
        return $this->medical;
    }
    /**
     * Get enabled
     *
     * @return boolean
     */
    public function getEnabled()
    {
        return $this->enabled;
    }
    /**
     * Set enabled
     *
     * @return boolean
     */
    public function setEnabled($enabled)
    {
        $this->enabled = $enabled;
        return $this;
    }
    /**
     * Set salt
     *
     * @param string $salt
     *
     * @return Person
     */
    public function setSalt($salt)
    {
        $this->salt = $salt;

        return $this;
    }
    /**
     * Get locked
     *
     * @return boolean
     */
    public function getLocked()
    {
        return $this->locked;
    }
    /**
     * Get expired
     *
     * @return boolean
     */
    public function getExpired()
    {
        return $this->expired;
    }
    /**
     * Get credentialsExpired
     *
     * @return boolean
     */
    public function getCredentialsExpired()
    {
        return $this->credentialsExpired;
    }
    /**
     * Add access
     *
     * @param \AppBundle\Entity\AccessAndFunction\Access $access
     *
     * @return Person
     */
    public function addAccess(\AppBundle\Entity\AccessAndFunction\Access $access)
    {
        $access->setPerson($this);
        $this->access[] = $access;

        return $this;
    }
    /**
     * Remove access
     *
     * @param \AppBundle\Entity\AccessAndFunction\Access $access
     */
    public function removeAccess(\AppBundle\Entity\AccessAndFunction\Access $access)
    {
        $this->access->removeElement($access);
    }
    /**
     * Get access
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getAccess()
    {
        return $this->access;
    }
    /**
     * Add file
     *
     * @param \AppBundle\Entity\Core\File $file
     *
     * @return Person
     */
    public function addFile(\AppBundle\Entity\Core\File $file)
    {
        $this->files[] = $file;

        return $this;
    }
    /**
     * Remove file
     *
     * @param \AppBundle\Entity\Core\File $file
     */
    public function removeFile(\AppBundle\Entity\Core\File $file)
    {
        $this->files->removeElement($file);
    }
    /**
     * Get files
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getFiles()
    {
        return $this->files;
    }
    /**
     * Add disciplineotherestablishment
     *
     * @param \AppBundle\Entity\Person\DisciplineOtherEstablishment $disciplineotherestablishment
     *
     * @return Person
     */
    public function addDisciplineotherestablishment(\AppBundle\Entity\Person\DisciplineOtherEstablishment $disciplineotherestablishment)
    {
        $disciplineotherestablishment->setPerson($this);
        $this->disciplineotherestablishments[] = $disciplineotherestablishment;

        return $this;
    }
    /**
     * Remove disciplineotherestablishment
     *
     * @param \AppBundle\Entity\Person\DisciplineOtherEstablishment $disciplineotherestablishment
     */
    public function removeDisciplineotherestablishment(\AppBundle\Entity\Person\DisciplineOtherEstablishment $disciplineotherestablishment)
    {
        $this->disciplineotherestablishments->removeElement($disciplineotherestablishment);
    }
    /**
     * Get disciplineotherestablishments
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getDisciplineotherestablishments()
    {
        return $this->disciplineotherestablishments;
    }
    /**
     * Add qualification
     *
     * @param \AppBundle\Entity\Person\Qualification $qualification
     *
     * @return Person
     */
    public function addQualification(\AppBundle\Entity\Person\Qualification $qualification)
    {
        $qualification->setPerson($this);
        $this->qualifications[] = $qualification;

        return $this;
    }
    /**
     * Remove qualification
     *
     * @param \AppBundle\Entity\Person\Qualification $qualification
     */
    public function removeQualification(\AppBundle\Entity\Person\Qualification $qualification)
    {
        $this->qualifications->removeElement($qualification);
    }
    /**
     * Get qualifications
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getQualifications()
    {
        return $this->qualifications;
    }
    /**
     * Add schoolingEstablisment
     *
     * @param \AppBundle\Entity\Person\SchoolingInEstablishment $schoolingEstablisment
     *
     * @return Person
     */
    public function addSchoolingEstablisment(\AppBundle\Entity\Person\SchoolingInEstablishment $schoolingEstablisment)
    {
        $schoolingEstablisment->setPerson($this);
        $this->schoolingEstablisments[] = $schoolingEstablisment;

        return $this;
    }
    /**
     * Remove schoolingEstablisment
     *
     * @param \AppBundle\Entity\Person\SchoolingInEstablishment $schoolingEstablisment
     */
    public function removeSchoolingEstablisment(\AppBundle\Entity\Person\SchoolingInEstablishment $schoolingEstablisment)
    {
        $this->schoolingEstablisments->removeElement($schoolingEstablisment);
    }
    /**
     * Get schoolingEstablisments
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getSchoolingEstablisments()
    {
        return $this->schoolingEstablisments;
    }
    /**
     * Add teacherSchoolingHistory
     *
     * @param \AppBundle\Entity\Person\TeacherSchoolingHistory $teacherSchoolingHistory
     *
     * @return Person
     */
    public function addTeacherSchoolingHistory(\AppBundle\Entity\Person\TeacherSchoolingHistory $teacherSchoolingHistory)
    {
        $teacherSchoolingHistory->setPerson($this);
        $this->teacherSchoolingHistories[] = $teacherSchoolingHistory;

        return $this;
    }
    /**
     * Remove teacherSchoolingHistory
     *
     * @param \AppBundle\Entity\Person\TeacherSchoolingHistory $teacherSchoolingHistory
     */
    public function removeTeacherSchoolingHistory(\AppBundle\Entity\Person\TeacherSchoolingHistory $teacherSchoolingHistory)
    {
        $this->teacherSchoolingHistories->removeElement($teacherSchoolingHistory);
    }
    /**
     * Get teacherSchoolingHistories
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getTeacherSchoolingHistories()
    {
        return $this->teacherSchoolingHistories;
    }
    /**
     * Gets age.
     *
     * @return int
     */
    public function getAgeTemplate()
    {
        $from = new \DateTime($this->getBirthDate());
        $to = new \DateTime('today');
        $age = $from->diff($to)->y;
        return $age > 0 ? $age : null;
    }
    /**
     * Gets full name.
     *
     * @return string
     */
    public function getFullNameTemplate()
    {
        return $this->getName() . ' ' . $this->getGivenName();
    }
    /**
     * Gets full name.
     *
     * @return string
     */
    public function getFullNameAndContactTemplate()
    {
        $fullNameAndContactTemplate[] = [ 'value' => $this->getGender(), 'translate' => true ];
        $fullNameAndContactTemplate[] = ' - ';
        $fullNameAndContactTemplate[] = $this->getFullNameTemplate();
        foreach ($this->getContactPoint() as $contactPoint) {
            $fullNameAndContactTemplate[] = ' - ';
            $fullNameAndContactTemplate[] = [ 'value' => $contactPoint->getContactType(), 'translate' => true ];
            $fullNameAndContactTemplate[] = ' : ';
          //  $fullNameAndContactTemplate = array_merge($fullNameAndContactTemplate, $contactPoint->getFullLabelTemplate());
        }
        return $fullNameAndContactTemplate;
    }
    /**
     * Add personFile
     *
     * @param \AppBundle\Entity\Core\File $personFile
     *
     * @return Person
     */
    public function addPersonFile(\AppBundle\Entity\Core\File $personFile)
    {
        $this->personFiles[] = $personFile;

        return $this;
    }
    /**
     * Remove personFile
     *
     * @param \AppBundle\Entity\Core\File $personFile
     */
    public function removePersonFile(\AppBundle\Entity\Core\File $personFile)
    {
        $this->personFiles->removeElement($personFile);
    }
    /**
     * Get personFiles
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPersonFiles()
    {
        return $this->personFiles;
    }
    /**
     * Get personFilesFiltered
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPersonFilesFiltered()
    {
        return $this->personFiles ? $this->personFiles->slice(0, 5) : [];
    }
    /**
     * @return Access
     */
    public function getAccessFavorite()
    {
        return $this->accessFavorite;
    }
    /**
     * @param int $accessFavorite
     */
    public function setAccessFavorite($accessFavorite)
    {
        $this->accessFavorite = $accessFavorite;
    }
    public function setLoginRequestedAt(\DateTime $date = null)
    {
        $this->loginRequestedAt = $date;

        return $this;
    }
    /**
     * Gets the timestamp that the user requested a auto login.
     *
     * @return null|\DateTime
     */
    public function getLoginRequestedAt()
    {
        return $this->loginRequestedAt;
    }
    public function isLoginRequestNonExpired($ttl)
    {
        return $this->getLoginRequestedAt() instanceof \DateTime &&
        $this->getLoginRequestedAt()->getTimestamp() + $ttl > time();
    }
    /**
     *
     * {@inheritdoc}
     */
    public function getContact()
    {
        return $this;
    }
    /**
     *
     * {@inheritdoc}
     */
    public function getContactAddress()
    {
        return $this->getAddressPostalForType(\AppBundle\Enum\Core\AddressPostalTypeEnum::ADDRESS_PRINCIPAL);
    }
    /**
     *
     * {@inheritdoc}
     */
    public function getContactContactPoint()
    {
        return $this->getContactPointPrincipal();
    }
    /**
     *
     * {@inheritdoc}
     */
    public function getContactName()
    {
        return $this->getFullname();
    }
    /**
     * Set profession
     *
     * @param string $profession
     *
     * @return Person
     */
    public function setProfession($profession)
    {
        $this->profession = $profession;

        return $this;
    }
    /**
     * Get profession
     *
     * @return string
     */
    public function getProfession()
    {
        return $this->profession;
    }
    /**
     * Add documentWish
     *
     * @param \AppBundle\Entity\AccessWish\DocumentWish $documentWish
     *
     * @return Person
     */
    public function addDocumentWish(\AppBundle\Entity\AccessWish\DocumentWish $documentWish)
    {
        $documentWish->setPersonOwner($this);
        $this->documentWishes[] = $documentWish;

        return $this;
    }
    /**
     * Remove documentWish
     *
     * @param \AppBundle\Entity\AccessWish\DocumentWish $documentWish
     */
    public function removeDocumentWish(\AppBundle\Entity\AccessWish\DocumentWish $documentWish)
    {
        $this->documentWishes->removeElement($documentWish);
    }
    /**
     * Get documentWishes
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getDocumentWishes()
    {
        return $this->documentWishes;
    }
}
