NewStructureArtistPremiumTrialRequest.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\ApiResources\Shop;
  4. use ApiPlatform\Metadata\ApiProperty;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use ApiPlatform\Metadata\Post;
  7. use App\Enum\Organization\LegalEnum;
  8. use App\Enum\Organization\PrincipalTypeEnum;
  9. use App\State\Processor\Shop\NewStructureArtistPremiumTrialRequestProcessor;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. /**
  12. * New structure trial request for the artist premium product.
  13. */
  14. #[ApiResource(
  15. operations: [
  16. new Post(
  17. uriTemplate: '/public/shop/new-structure-artist-premium-trial-request',
  18. processor: NewStructureArtistPremiumTrialRequestProcessor::class
  19. ),
  20. ]
  21. )]
  22. class NewStructureArtistPremiumTrialRequest
  23. {
  24. /**
  25. * Id 'bidon' ajouté par défaut pour permettre la construction
  26. * de l'IRI par api platform.
  27. */
  28. #[ApiProperty(identifier: true)]
  29. private int $id = 0;
  30. #[Assert\Length(
  31. min: 2,
  32. minMessage: "Structure's name must be at least {{ limit }} characters long",
  33. )]
  34. private string $structureName;
  35. #[Assert\NotBlank]
  36. private string $address;
  37. private ?string $addressComplement = null;
  38. #[Assert\Length(
  39. min: 3,
  40. minMessage: 'Postal code must be at least {{ limit }} characters long',
  41. )]
  42. private string $postalCode;
  43. #[Assert\Length(
  44. min: 1,
  45. minMessage: 'City must be at least {{ limit }} characters long',
  46. )]
  47. private string $city;
  48. #[Assert\NotBlank]
  49. #[Assert\Email(message: 'The email {{ value }} is not a valid email.')]
  50. private string $structureEmail;
  51. private PrincipalTypeEnum $structureType;
  52. private LegalEnum $legalStatus;
  53. #[Assert\Regex(pattern: '/^|(\d{9})$/')]
  54. private string $siren;
  55. #[Assert\Length(
  56. min: 1,
  57. minMessage: 'Representative first name must be at least {{ limit }} characters long',
  58. )]
  59. private string $representativeFirstName;
  60. #[Assert\Length(
  61. min: 1,
  62. minMessage: 'Representative last name must be at least {{ limit }} characters long',
  63. )]
  64. private string $representativeLastName;
  65. #[Assert\Length(
  66. min: 1,
  67. minMessage: 'Representative function must be at least {{ limit }} characters long',
  68. )]
  69. private string $representativeFunction;
  70. #[Assert\NotBlank]
  71. #[Assert\Email(message: 'The email {{ value }} is not a valid email.')]
  72. private string $representativeEmail;
  73. #[Assert\Length(
  74. min: 10,
  75. minMessage: 'Phone number must be at least {{ limit }} characters long',
  76. )]
  77. private string $representativePhone;
  78. #[Assert\IsTrue(message: 'terms-must-be-accepted')]
  79. private bool $termsAccepted = false;
  80. private bool $legalRepresentative = false;
  81. private bool $newsletterSubscription = false;
  82. public function getId(): int
  83. {
  84. return $this->id;
  85. }
  86. public function setId(int $id): self
  87. {
  88. $this->id = $id;
  89. return $this;
  90. }
  91. public function getStructureName(): string
  92. {
  93. return $this->structureName;
  94. }
  95. public function setStructureName(string $structureName): self
  96. {
  97. $this->structureName = $structureName;
  98. return $this;
  99. }
  100. public function getAddress(): string
  101. {
  102. return $this->address;
  103. }
  104. public function setAddress(string $address): self
  105. {
  106. $this->address = $address;
  107. return $this;
  108. }
  109. public function getAddressComplement(): ?string
  110. {
  111. return $this->addressComplement;
  112. }
  113. public function setAddressComplement(?string $addressComplement): self
  114. {
  115. $this->addressComplement = $addressComplement;
  116. return $this;
  117. }
  118. public function getPostalCode(): string
  119. {
  120. return $this->postalCode;
  121. }
  122. public function setPostalCode(string $postalCode): self
  123. {
  124. $this->postalCode = $postalCode;
  125. return $this;
  126. }
  127. public function getCity(): string
  128. {
  129. return $this->city;
  130. }
  131. public function setCity(string $city): self
  132. {
  133. $this->city = $city;
  134. return $this;
  135. }
  136. public function getStructureEmail(): string
  137. {
  138. return $this->structureEmail;
  139. }
  140. public function setStructureEmail(string $structureEmail): self
  141. {
  142. $this->structureEmail = $structureEmail;
  143. return $this;
  144. }
  145. public function getStructureType(): PrincipalTypeEnum
  146. {
  147. return $this->structureType;
  148. }
  149. public function setStructureType(PrincipalTypeEnum $structureType): self
  150. {
  151. $this->structureType = $structureType;
  152. return $this;
  153. }
  154. public function getLegalStatus(): LegalEnum
  155. {
  156. return $this->legalStatus;
  157. }
  158. public function setLegalStatus(LegalEnum $legalStatus): self
  159. {
  160. $this->legalStatus = $legalStatus;
  161. return $this;
  162. }
  163. public function getSiren(): string
  164. {
  165. return $this->siren;
  166. }
  167. public function setSiren(string $siren): self
  168. {
  169. $this->siren = $siren;
  170. return $this;
  171. }
  172. public function getRepresentativeFirstName(): string
  173. {
  174. return $this->representativeFirstName;
  175. }
  176. public function setRepresentativeFirstName(string $representativeFirstName): self
  177. {
  178. $this->representativeFirstName = $representativeFirstName;
  179. return $this;
  180. }
  181. public function getRepresentativeLastName(): string
  182. {
  183. return $this->representativeLastName;
  184. }
  185. public function setRepresentativeLastName(string $representativeLastName): self
  186. {
  187. $this->representativeLastName = $representativeLastName;
  188. return $this;
  189. }
  190. public function getRepresentativeFunction(): string
  191. {
  192. return $this->representativeFunction;
  193. }
  194. public function setRepresentativeFunction(string $representativeFunction): self
  195. {
  196. $this->representativeFunction = $representativeFunction;
  197. return $this;
  198. }
  199. public function getRepresentativeEmail(): string
  200. {
  201. return $this->representativeEmail;
  202. }
  203. public function setRepresentativeEmail(string $representativeEmail): self
  204. {
  205. $this->representativeEmail = $representativeEmail;
  206. return $this;
  207. }
  208. public function getRepresentativePhone(): string
  209. {
  210. return $this->representativePhone;
  211. }
  212. public function setRepresentativePhone(string $representativePhone): self
  213. {
  214. $this->representativePhone = $representativePhone;
  215. return $this;
  216. }
  217. public function getTermsAccepted(): bool
  218. {
  219. return $this->termsAccepted;
  220. }
  221. public function setTermsAccepted(bool $termsAccepted): self
  222. {
  223. $this->termsAccepted = $termsAccepted;
  224. return $this;
  225. }
  226. public function getLegalRepresentative(): bool
  227. {
  228. return $this->legalRepresentative;
  229. }
  230. public function setLegalRepresentative(bool $legalRepresentative): self
  231. {
  232. $this->legalRepresentative = $legalRepresentative;
  233. return $this;
  234. }
  235. public function getNewsletterSubscription(): bool
  236. {
  237. return $this->newsletterSubscription;
  238. }
  239. public function setNewsletterSubscription(bool $newsletterSubscription): self
  240. {
  241. $this->newsletterSubscription = $newsletterSubscription;
  242. return $this;
  243. }
  244. }