<?php

namespace AppBundle\Entity\Billing;

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\Traits\TimestampableEntity;
use AppBundle\Entity\Traits\CreatorUpdaterEntity;

/**
 * Période associée à une facture
 * (Ex: Deuxième trimestre 2020)
 *
 * @Iri("http://schema.org/BillPeriod")
 */
#[ORM\Entity]
class BillPeriod
{
    use TimestampableEntity;
    use CreatorUpdaterEntity;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups(['billperiod', 'billaccounting_list', 'bill_list', 'billcredit_list', 'advancepayment_list', 'build_bills', 'billcredit_list', 'advancepayment_list'])]
    private $id;
    /**
     * @var
     */
    #[ORM\Column(type: 'string', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Assert\Choice(callback: ['\AppBundle\Enum\Billing\PeriodicityEnum', 'toArray'])]
    #[Groups(['billperiod', 'billaccounting_list_billperiod', 'bill_list_billperiod', 'billcredit_list_billperiod', 'build_bills_billperiod'])]
    private $periodicity;
    /**
     * @var string
     *
     *
     */
    #[ORM\Column(type: 'string', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['billperiod', 'billaccounting_list_billperiod', 'bill_list_billperiod', 'billpayment_list_bill', 'billcredit_list_billperiod', 'advancepayment_list_billperiod', 'build_bills_billperiod', 'billcredit_list_billperiod', 'advancepayment_list_billperiod'])]
    private $schoolYear;
    /**
     * @var \DateTime
     *
     * @Iri("https://schema.org/detailDateStart")
     */
    #[ORM\Column(type: 'date', nullable: true)]
    #[Assert\Date]
    #[Groups(['billperiod', 'build_bills_billperiod'])]
    private $detailDateStart;
    /**
     * @var \DateTime
     *
     * @Iri("https://schema.org/detailDateEnd")
     */
    #[ORM\Column(type: 'date', nullable: true)]
    #[Assert\Date]
    #[Groups(['billperiod'])]
    private $detailDateEnd;
    /**
     * @var
     */
    #[ORM\Column(type: 'string', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Assert\Choice(callback: ['\AppBundle\Enum\Billing\PeriodEnum', 'toArray'])]
    #[Groups(['billperiod', 'billaccounting_list_billperiod', 'bill_list_billperiod', 'billpayment_list_bill', 'billcredit_list_billperiod', 'build_bills_billperiod'])]
    private $detailLabel;
    /**
     * @var \DateTime
     */
    #[ORM\Column(type: 'date', nullable: true)]
    #[Assert\Date]
    #[Groups(['billperiod', 'build_bills_billperiod'])]
    private $uniqDate;
    /**
     * Constructor
     */
    public function __construct()
    {
    }
    /**
     * 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;
    }
    /**
     * Set periodicity
     *
     * @param string $periodicity
     *
     * @return BillPeriod
     */
    public function setPeriodicity($periodicity)
    {
        $this->periodicity = $periodicity;

        return $this;
    }
    /**
     * Get periodicity
     *
     * @return string
     */
    public function getPeriodicity()
    {
        return $this->periodicity;
    }
    /**
     * Set schoolYear
     *
     * @param string $schoolYear
     *
     * @return BillPeriod
     */
    public function setSchoolYear($schoolYear)
    {
        $this->schoolYear = $schoolYear;

        return $this;
    }
    /**
     * Get schoolYear
     *
     * @return string
     */
    public function getSchoolYear()
    {
        return $this->schoolYear;
    }
    /**
     * Set detailDateStart
     *
     * @param \DateTime $detailDateStart
     *
     * @return BillPeriod
     */
    public function setDetailDateStart($detailDateStart)
    {
        $this->detailDateStart = $detailDateStart;

        return $this;
    }
    /**
     * Get detailDateStart
     *
     * @return \DateTime
     */
    public function getDetailDateStart()
    {
        return $this->detailDateStart ? $this->detailDateStart->format('Y-m-d') : $this->detailDateStart;
    }
    /**
     * Set detailDateEnd
     *
     * @param \DateTime $detailDateEnd
     *
     * @return BillPeriod
     */
    public function setDetailDateEnd($detailDateEnd)
    {
        $this->detailDateEnd = $detailDateEnd;

        return $this;
    }
    /**
     * Get detailDateEnd
     *
     * @return \DateTime
     */
    public function getDetailDateEnd()
    {
        return $this->detailDateEnd ? $this->detailDateEnd->format('Y-m-d') : $this->detailDateEnd;
    }
    /**
     * Set uniqDate
     *
     * @param \DateTime $uniqDate
     *
     * @return BillPeriod
     */
    public function setUniqDate($uniqDate)
    {
        $this->uniqDate = $uniqDate;

        return $this;
    }
    /**
     * Get uniqDate
     *
     * @return \DateTime
     */
    public function getUniqDate()
    {
        return $this->uniqDate ? $this->uniqDate->format('Y-m-d') : $this->uniqDate;
    }
    /**
     * Set detailLabel
     *
     * @param string $detailLabel
     *
     * @return BillPeriod
     */
    public function setDetailLabel($detailLabel)
    {
        $this->detailLabel = $detailLabel;

        return $this;
    }
    /**
     * Get detailLabel
     *
     * @return string
     */
    public function getDetailLabel()
    {
        return $this->detailLabel;
    }
}
