<?php
declare (strict_types=1);

namespace App\ApiResources\Profile;

use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\Get;
use App\ApiResources\ApiResourcesInterface;
use App\Entity\Organization\Organization;
use Symfony\Component\Serializer\Annotation\Groups;

/**
 * Classe resource qui contient les champs relatifs aux organizations présentent dans la requete my_profile.
 */
#[ApiResource(
    operations: [
        new Get()
    ]
)]
class OrganizationProfile implements ApiResourcesInterface
{
    #[ApiProperty(identifier: true)]
    #[Groups('access_profile_read')]
    public ?int $id = null;

    #[Groups('access_profile_read')]
    private ?string $name = null;

    #[Groups('access_profile_read')]
    private ?string $product = null;

    #[Groups('access_profile_read')]
    private ?string $legalStatus = null;

    /** @var list<string> $networks  */
    #[Groups('access_profile_read')]
    private array $networks = [];

    #[Groups('access_profile_read')]
    private ?string $website = null;

    /** @var list<string>|null $modules  */
    #[Groups('access_profile_read')]
    private ?array $modules = [];

    #[Groups('access_profile_read')]
    private bool $hasChildren = false;

    /** @var list<Organization>|null  */
    #[Groups('access_profile_read')]
    private ?array $parents = [];

    #[Groups('access_profile_read')]
    private bool $showAdherentList = false;

    #[Groups('access_profile_read')]
    private ?int $currentYear = null;

    #[Groups('access_profile_read')]
    private ?int $parametersId = null;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function setId(?int $id): self
    {
        $this->id = $id;
        return $this;
    }

    public function getName(): ?string
    {
        return $this->name;
    }

    public function setName(?string $name): self
    {
        $this->name = $name;
        return $this;
    }

    public function getProduct(): ?string
    {
        return $this->product;
    }

    public function setProduct(?string $product): self
    {
        $this->product = $product;
        return $this;
    }

    public function getLegalStatus(): ?string
    {
        return $this->legalStatus;
    }

    public function setLegalStatus(?string $legalStatus): self
    {
        $this->legalStatus = $legalStatus;
        return $this;
    }

    /**
     * @return list<string>
     */
    public function getNetworks(): array
    {
        return $this->networks;
    }

    public function addNetwork(?string $network): self
    {
        $this->networks[] = $network;
        return $this;
    }

    public function getWebsite(): ?string
    {
        return $this->website;
    }

    public function setWebsite(?string $website): self
    {
        $this->website = $website;
        return $this;
    }

    /**
     * @return list<string>
     */
    public function getModules(): array
    {
        $modules = $this->modules;
        return array_unique($modules);
    }

    /**
     * @param list<string> $modules
     * @return $this
     */
    public function setModules(array $modules): self
    {
        $this->modules = $modules;
        return $this;
    }

    public function getHasChildren(): bool
    {
        return $this->hasChildren;
    }

    public function setHasChildren(bool $hasChildren): self
    {
        $this->hasChildren = $hasChildren;
        return $this;
    }

    /**
     * @return list<Organization>
     */
    public function getParents(): array
    {
        return $this->parents;
    }

    public function addParent(OrganizationProfile $parent): self
    {
        $this->parents[] = $parent;
        return $this;
    }

    public function getShowAdherentList(): bool
    {
        return $this->showAdherentList;
    }

    public function setShowAdherentList(bool $showAdherentList): self
    {
        $this->showAdherentList = $showAdherentList;
        return $this;
    }

    public function getCurrentYear(): ?int
    {
        return $this->currentYear;
    }

    public function setCurrentYear(?int $currentYear): self
    {
        $this->currentYear = $currentYear;
        return $this;
    }

    public function getParametersId(): ?int
    {
        return $this->parametersId;
    }

    public function setParametersId(?int $parametersId): self
    {
        $this->parametersId = $parametersId;
        return $this;
    }
}
