<?php
namespace App\Entity\Channel\ProfessionalId;
use App\Entity\Sync\SyncableInterface;
use App\Enum\FrenchProfessionalLegalFormEnum;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\Channel\ProfessionalId\FrenchProfessionalIdRepository;
use Nellapp\Bundle\SDKBundle\Channel\Entity\ProfessionalId\FrenchProfessionalIdIdInterface;
use Nellapp\Bundle\SDKBundle\Channel\Entity\ProfessionalId\FrenchProfessionalIdMethodTrait;
use Nellapp\Bundle\SDKBundle\Sync\EntityKeys;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Serializer\Annotation as Serial;
#[
ORM\Entity(repositoryClass: FrenchProfessionalIdRepository::class),
]
class FrenchProfessionalId extends ProfessionalId implements FrenchProfessionalIdIdInterface, SyncableInterface
{
use FrenchProfessionalIdMethodTrait;
#[ORM\Column(type: 'string', length: 14, nullable: true)]
#[Assert\Length(
min: 9,
max: 14,
minMessage: 'channel.professional_id.french.siret.Length.min',
maxMessage: 'channel.professional_id.french.siret.Length.max',
)]
#[Assert\Luhn(
message: 'channel.professional_id.french.siret.luhn'
)]
#[Serial\Groups(['Sync'])]
private ?string $siret = null;
#[ORM\Column(type: 'string', length: 20, nullable: true)]
#[Assert\Choice(callback: [FrenchProfessionalLegalFormEnum::class, 'getChoices'],)]
#[Serial\Groups(['Sync'])]
private ?string $legalForm = null;
public static function getSyncKey(): string
{
return EntityKeys::CHANNEL_FRENCH_PROFESSIONAL_ID;
}
public function getSyncDisplayLabel(): string
{
return 'Identifiant professionnel';
}
}