<?php

declare(strict_types=1);

namespace App\ApiResources\Shop;

use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Post;
use App\Enum\Organization\LegalEnum;
use App\Enum\Organization\PrincipalTypeEnum;
use App\State\Processor\Shop\NewStructureArtistPremiumTrialRequestProcessor;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * New structure trial request for the artist premium product.
 */
#[ApiResource(
    operations: [
        new Post(
            uriTemplate: '/public/shop/new-structure-artist-premium-trial-request',
            processor: NewStructureArtistPremiumTrialRequestProcessor::class
        ),
    ]
)]
class NewStructureArtistPremiumTrialRequest
{
    /**
     * Id 'bidon' ajouté par défaut pour permettre la construction
     * de l'IRI par api platform.
     */
    #[ApiProperty(identifier: true)]
    private int $id = 0;

    #[Assert\Length(
        min: 2,
        minMessage: "Structure's name must be at least {{ limit }} characters long",
    )]
    private string $structureName;

    #[Assert\NotBlank]
    private string $address;

    private ?string $addressComplement = null;

    #[Assert\Length(
        min: 3,
        minMessage: 'Postal code must be at least {{ limit }} characters long',
    )]
    private string $postalCode;

    #[Assert\Length(
        min: 1,
        minMessage: 'City must be at least {{ limit }} characters long',
    )]
    private string $city;

    #[Assert\NotBlank]
    #[Assert\Email(message: 'The email {{ value }} is not a valid email.')]
    private string $structureEmail;

    private PrincipalTypeEnum $structureType;

    private LegalEnum $legalStatus;

    #[Assert\Regex(pattern: '/^|(\d{9})$/')]
    private string $siren;

    #[Assert\Length(
        min: 1,
        minMessage: 'Representative first name must be at least {{ limit }} characters long',
    )]
    private string $representativeFirstName;

    #[Assert\Length(
        min: 1,
        minMessage: 'Representative last name must be at least {{ limit }} characters long',
    )]
    private string $representativeLastName;

    #[Assert\Length(
        min: 1,
        minMessage: 'Representative function must be at least {{ limit }} characters long',
    )]
    private string $representativeFunction;

    #[Assert\NotBlank]
    #[Assert\Email(message: 'The email {{ value }} is not a valid email.')]
    private string $representativeEmail;

    #[Assert\Length(
        min: 10,
        minMessage: 'Phone number must be at least {{ limit }} characters long',
    )]
    private string $representativePhone;

    #[Assert\IsTrue(message: 'terms-must-be-accepted')]
    private bool $termsAccepted = false;

    private bool $legalRepresentative = false;

    private bool $newsletterSubscription = false;

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

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

        return $this;
    }

    public function getStructureName(): string
    {
        return $this->structureName;
    }

    public function setStructureName(string $structureName): self
    {
        $this->structureName = $structureName;

        return $this;
    }

    public function getAddress(): string
    {
        return $this->address;
    }

    public function setAddress(string $address): self
    {
        $this->address = $address;

        return $this;
    }

    public function getAddressComplement(): ?string
    {
        return $this->addressComplement;
    }

    public function setAddressComplement(?string $addressComplement): self
    {
        $this->addressComplement = $addressComplement;

        return $this;
    }

    public function getPostalCode(): string
    {
        return $this->postalCode;
    }

    public function setPostalCode(string $postalCode): self
    {
        $this->postalCode = $postalCode;

        return $this;
    }

    public function getCity(): string
    {
        return $this->city;
    }

    public function setCity(string $city): self
    {
        $this->city = $city;

        return $this;
    }

    public function getStructureEmail(): string
    {
        return $this->structureEmail;
    }

    public function setStructureEmail(string $structureEmail): self
    {
        $this->structureEmail = $structureEmail;

        return $this;
    }

    public function getStructureType(): PrincipalTypeEnum
    {
        return $this->structureType;
    }

    public function setStructureType(PrincipalTypeEnum $structureType): self
    {
        $this->structureType = $structureType;

        return $this;
    }

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

    public function setLegalStatus(LegalEnum $legalStatus): self
    {
        $this->legalStatus = $legalStatus;

        return $this;
    }

    public function getSiren(): string
    {
        return $this->siren;
    }

    public function setSiren(string $siren): self
    {
        $this->siren = $siren;

        return $this;
    }

    public function getRepresentativeFirstName(): string
    {
        return $this->representativeFirstName;
    }

    public function setRepresentativeFirstName(string $representativeFirstName): self
    {
        $this->representativeFirstName = $representativeFirstName;

        return $this;
    }

    public function getRepresentativeLastName(): string
    {
        return $this->representativeLastName;
    }

    public function setRepresentativeLastName(string $representativeLastName): self
    {
        $this->representativeLastName = $representativeLastName;

        return $this;
    }

    public function getRepresentativeFunction(): string
    {
        return $this->representativeFunction;
    }

    public function setRepresentativeFunction(string $representativeFunction): self
    {
        $this->representativeFunction = $representativeFunction;

        return $this;
    }

    public function getRepresentativeEmail(): string
    {
        return $this->representativeEmail;
    }

    public function setRepresentativeEmail(string $representativeEmail): self
    {
        $this->representativeEmail = $representativeEmail;

        return $this;
    }

    public function getRepresentativePhone(): string
    {
        return $this->representativePhone;
    }

    public function setRepresentativePhone(string $representativePhone): self
    {
        $this->representativePhone = $representativePhone;

        return $this;
    }

    public function getTermsAccepted(): bool
    {
        return $this->termsAccepted;
    }

    public function setTermsAccepted(bool $termsAccepted): self
    {
        $this->termsAccepted = $termsAccepted;

        return $this;
    }

    public function getLegalRepresentative(): bool
    {
        return $this->legalRepresentative;
    }

    public function setLegalRepresentative(bool $legalRepresentative): self
    {
        $this->legalRepresentative = $legalRepresentative;

        return $this;
    }

    public function getNewsletterSubscription(): bool
    {
        return $this->newsletterSubscription;
    }

    public function setNewsletterSubscription(bool $newsletterSubscription): self
    {
        $this->newsletterSubscription = $newsletterSubscription;

        return $this;
    }
}
