<?php

namespace AppBundle\Entity\Organization;

use AppBundle\Annotation\DefaultField;
use AppBundle\Entity\Core\AddressPostal;
use AppBundle\Enum\Core\AddressPostalTypeEnum;
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;

/**
 * Lien entre une Organization et un article la concernant sur un site externe
 *
 * @Iri("http://schema.org/OrganizationArticle")
 */
#[ORM\Entity]
class OrganizationArticle
{
    use TimestampableEntity;
    use CreatorUpdaterEntity;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups(['organizationarticle', 'organization_communication_edit', 'organization_cotisation_steps'])]
    private $id;
    /**
     * @var Organization
     *
     * @DefaultField
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Organization\Organization', inversedBy: 'organizationArticles')]
    #[ORM\JoinColumn(nullable: false)]
    #[Assert\NotNull]
    #[Groups(['organizationarticle'])]
    private $organization;
    /**
     * @var string The title of the item.
     *
     * @Iri("https://schema.org/name")
     */
    #[ORM\Column(type: 'string', nullable: true, length: 128)]
    #[Assert\Type(type: 'string')]
    #[Groups(['organizationarticle', 'organization_communication_edit_organizationarticles', 'organization_cotisation_steps_organizationarticles'])]
    private $title;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string', length: 255, nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['organizationarticle', 'organization_communication_edit_organizationarticles', 'organization_cotisation_steps_organizationarticles'])]
    private $link;
    /**
     * @var \DateTime
     */
    #[ORM\Column(type: 'date', nullable: true)]
    #[Assert\Date]
    #[Groups(['organizationarticle', 'organization_communication_edit_organizationarticles', 'organization_cotisation_steps_organizationarticles'])]
    private $date;
    /**
     * 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 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;
    }
    /**
     * Set title
     *
     * @param string $title
     *
     * @return OrganizationArticle
     */
    public function setTitle($title)
    {
        $this->title = $title;

        return $this;
    }
    /**
     * Get title
     *
     * @return string
     */
    public function getTitle()
    {
        return $this->title;
    }
    /**
     * Set link
     *
     * @param string $link
     *
     * @return OrganizationArticle
     */
    public function setLink($link)
    {
        $this->link = $link;

        return $this;
    }
    /**
     * Get link
     *
     * @return string
     */
    public function getLink()
    {
        return $this->link;
    }
    /**
     * @return \DateTime
     */
    public function getDate()
    {
        return $this->date;
    }
    /**
     * @param \DateTime $date
     */
    public function setDate($date)
    {
        $this->date = $date;
    }
}
