<?php

namespace AppBundle\Entity\Network;

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;

/**
 * Enum des différents réseaux auxquels peut appartenir une Organization
 *
 * @Iri("http://schema.org/Network")
 */
#[ORM\Entity]
class Network
{
    use TimestampableEntity;
    use CreatorUpdaterEntity;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups(['network', 'organization_cotisation_steps'])]
    private $id;
    /**
     * @var ArrayCollection<NetworkOrganization>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Network\NetworkOrganization', mappedBy: 'network', orphanRemoval: true)]
    #[Groups(['network_networkorganization'])]
    private $organizations;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string')]
    #[Assert\Type(type: 'string')]
    #[Assert\NotNull]
    #[Groups(['network', 'organization_create_network', 'organization_details_network', 'organization_params_list_network'])]
    private $name;
    #[ORM\Column(type: 'string', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['network', 'organization_create_network'])]
    private $logo;
    #[ORM\Column(type: 'string', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['network', 'organization_create_network'])]
    private $url;
    public function __construct()
    {
        $this->organizations = new ArrayCollection();
    }
    /**
     * 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;
    }
    /**
     * Adds organizations.
     *
     * @param NetworkOrganization $organizations
     *
     * @return $this
     */
    public function addOrganizations(NetworkOrganization $organizations)
    {
        $this->organizations[] = $organizations;

        return $this;
    }
    /**
     * Removes organizations.
     *
     * @param NetworkOrganization $organizations
     *
     * @return $this
     */
    public function removeOrganizations(NetworkOrganization $organizations)
    {
        $this->organizations->removeElement($organizations);
        return $this;
    }
    /**
     * Gets organizations.
     *
     * @return ArrayCollection<NetworkOrganization>
     */
    public function getOrganizations()
    {
        return $this->organizations;
    }
    /**
     * Sets name.
     *
     * @param string $name
     *
     * @return $this
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }
    /**
     * Gets name.
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }
    /**
     * Sets logo.
     *
     * @param string $logo
     * @return $this
     */
    public function setLogo($logo) {
        $this->logo = $logo;
        return $this;
    }
    /**
     * Gets logo.
     *
     * @return string
     */
    public function getLogo() {
        return $this->logo;
    }
    /**
     * Gets url.
     *
     * @return string
     */
    public function getUrl() {
        return $this->url;
    }
    /**
     * Sets url.
     *
     * @param string $url
     * @return $this
     */
    public function setUrl($url) {
        $this->url = $url;
        return $this;
    }
    /**
     * Add organization
     *
     * @param \AppBundle\Entity\Network\NetworkOrganization $organization
     *
     * @return Network
     */
    public function addOrganization(\AppBundle\Entity\Network\NetworkOrganization $organization)
    {
        $this->organizations[] = $organization;

        return $this;
    }
    /**
     * Remove organization
     *
     * @param \AppBundle\Entity\Network\NetworkOrganization $organization
     */
    public function removeOrganization(\AppBundle\Entity\Network\NetworkOrganization $organization)
    {
        $this->organizations->removeElement($organization);
    }
}
