<?php

namespace AppBundle\Entity\Donor;

use AppBundle\Annotation\DefaultField;
use AppBundle\Entity\AccessAndFunction\Access;
use AppBundle\Entity\Organization\Organization;
use AppBundle\Entity\Traits\ActivityPeriodTrait;
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\Traits\TimestampableEntity;
use AppBundle\Entity\Traits\CreatorUpdaterEntity;

/**
 * Don d'un Access à une Organization
 *
 * @Iri("http://schema.org/Donor")
 */
#[ORM\Entity]
class Donor
{
    use TimestampableEntity;
    use CreatorUpdaterEntity;
    use ActivityPeriodTrait;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups(['donor', 'donor_list', 'access_details', 'access_details_organization'])]
    private $id;
    /**
     * @var Access
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'donors')]
    #[ORM\JoinColumn(nullable: false)]
    #[Assert\NotNull]
    #[Groups(['donor', 'donor_list', 'access_details_organization'])]
    private $access;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string', length: 40, nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['donor', 'donor_list', 'access_details_donorsfiltered'])]
    private $wording;
    /**
     * @var float
     *
     *
     */
    #[ORM\Column(type: 'float', nullable: true)]
    #[Assert\Type(type: 'float')]
    #[Groups(['donor', 'donor_list', 'access_details_donorsfiltered'])]
    private $amount;
    /**
     * @var \DateTime
     */
    #[ORM\Column(type: 'date', nullable: true)]
    #[Assert\Date]
    #[Groups(['donor', 'donor_list'])]
    private $paymentDate;
    /**
     * @var bool
     */
    #[ORM\Column(type: 'boolean', options: ['default' => false], nullable: true)]
    #[Assert\Type(type: 'boolean')]
    #[Groups(['donor', 'donor_list'])]
    private $emailVisibility;
    /**
     * @var bool
     */
    #[ORM\Column(type: 'boolean', options: ['default' => false], nullable: true)]
    #[Assert\Type(type: 'boolean')]
    #[Groups(['donor', 'donor_list'])]
    private $logoVisibility;
    /**
     * @var bool
     */
    #[ORM\Column(type: 'boolean', options: ['default' => false], nullable: true)]
    #[Assert\Type(type: 'boolean')]
    #[Groups(['donor', 'donor_list', 'access_details_organization'])]
    private $donorVisibility;
    /**
     * @var string
     */
    #[ORM\Column(type: 'simple_array', nullable: true)]
    #[Assert\Type(type: 'array')]
    #[Assert\Choice(callback: ['\AppBundle\Enum\Donor\DonorDisplayedOnEnum', 'toArray'], multiple: true)]
    #[Groups(['donor'])]
    private $displayedOn;
    /**
     * @var Organization
     *
     * @DefaultField()
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Organization\Organization', inversedBy: 'donors')]
    #[Groups(['donor'])]
    private $organization;
    /**
     * @var bool
     */
    #[ORM\Column(type: 'boolean', options: ['default' => false], nullable: true)]
    #[Assert\Type(type: 'boolean')]
    #[Groups(['donor', 'donor_list', 'access_details_organization'])]
    private $federationDisplay;
    /**
     * @var bool
     */
    #[ORM\Column(type: 'boolean', options: ['default' => false], nullable: true)]
    #[Assert\Type(type: 'boolean')]
    #[Groups(['donor', 'donor_list', 'access_details_organization'])]
    private $associationDisplay;
    /**
     * Sets id.
     *
     * @param int $id
     *
     * @return $this
     */
    public function setId($id)
    {
        $this->id = $id;

        return $this;
    }
    /**
     * Gets id.
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }
    /**
     * Sets access.
     *
     * @param Access $access
     *
     * @return $this
     */
    public function setAccess(Access $access)
    {
        $this->access = $access;

        return $this;
    }
    /**
     * Gets access.
     *
     * @return Access
     */
    public function getAccess()
    {
        return $this->access;
    }
    /**
     * Sets wording.
     *
     * @param string $wording
     *
     * @return $this
     */
    public function setWording($wording)
    {
        $this->wording = $wording;

        return $this;
    }
    /**
     * Gets wording.
     *
     * @return string
     */
    public function getWording()
    {
        return $this->wording;
    }
    /**
     * Sets organization.
     *
     * @param Organization $organization
     *
     * @return $this
     */
    public function setOrganization(Organization $organization)
    {
        $this->organization = $organization;

        return $this;
    }
    /**
     * Gets organization.
     *
     * @return Organization
     */
    public function getOrganization()
    {
        return $this->organization;
    }
    /**
     * Sets amount.
     *
     * @param float $amount
     *
     * @return $this
     */
    public function setAmount($amount)
    {
        $amount = floatval($amount);
        $this->amount = $amount;

        return $this;
    }
    /**
     * Gets amount.
     *
     * @return float
     */
    public function getAmount()
    {
        return $this->amount;
    }
    /**
     * Sets paymentDate.
     *
     * @param \DateTime $paymentDate
     *
     * @return $this
     */
    public function setPaymentDate(\DateTime $paymentDate = null)
    {
        $this->paymentDate = $paymentDate;

        return $this;
    }
    /**
     * Gets paymentDate.
     *
     * @return \DateTime
     */
    public function getPaymentDate()
    {
        return $this->paymentDate ? $this->paymentDate->format('Y-m-d') : $this->paymentDate;
    }
    /**
     * Sets emailVisibility.
     *
     * @param bool $emailVisibility
     *
     * @return $this
     */
    public function setEmailVisibility($emailVisibility)
    {
        $this->emailVisibility = $emailVisibility;

        return $this;
    }
    /**
     * Gets emailVisibility.
     *
     * @return bool
     */
    public function getEmailVisibility()
    {
        return $this->emailVisibility;
    }
    /**
     * Sets logoVisibility.
     *
     * @param bool $logoVisibility
     *
     * @return $this
     */
    public function setLogoVisibility($logoVisibility)
    {
        $this->logoVisibility = $logoVisibility;

        return $this;
    }
    /**
     * Gets logoVisibility.
     *
     * @return bool
     */
    public function getLogoVisibility()
    {
        return $this->logoVisibility;
    }
    /**
     * Sets displayedOn.
     *
     * @param string $displayedOn
     *
     * @return $this
     */
    public function setDisplayedOn($displayedOn)
    {
        $this->displayedOn = $displayedOn;

        return $this;
    }
    /**
     * Gets displayedOn.
     *
     * @return string
     */
    public function getDisplayedOn()
    {
        return $this->displayedOn;
    }
    /**
     * @return bool
     */
    public function isDonorVisibility()
    {
        return $this->donorVisibility;
    }
    /**
     * @param bool $donorVisibility
     */
    public function setDonorVisibility($donorVisibility)
    {
        $this->donorVisibility = $donorVisibility;
    }
    /**
     * Set federationDisplay
     *
     * @param boolean $federationDisplay
     *
     * @return Donor
     */
    public function setFederationDisplay($federationDisplay)
    {
        $this->federationDisplay = $federationDisplay;

        return $this;
    }
    /**
     * Get federationDisplay
     *
     * @return boolean
     */
    public function getFederationDisplay()
    {
        return $this->federationDisplay;
    }
    /**
     * Set associationDisplay
     *
     * @param boolean $associationDisplay
     *
     * @return Donor
     */
    public function setAssociationDisplay($associationDisplay)
    {
        $this->associationDisplay = $associationDisplay;

        return $this;
    }
    /**
     * Get associationDisplay
     *
     * @return boolean
     */
    public function getAssociationDisplay()
    {
        return $this->associationDisplay;
    }
}
