OrganizationCreationRequest.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <?php
  2. namespace App\ApiResources\Organization;
  3. use ApiPlatform\Metadata\ApiProperty;
  4. use ApiPlatform\Metadata\ApiResource;
  5. use ApiPlatform\Metadata\Post;
  6. use App\Enum\Organization\LegalEnum;
  7. use App\Enum\Organization\PrincipalTypeEnum;
  8. use App\Enum\Organization\SettingsProductEnum;
  9. use App\State\Processor\Organization\OrganizationCreationRequestProcessor;
  10. #[ApiResource(
  11. operations: [
  12. new Post(
  13. uriTemplate: '/internal/organization/create',
  14. security: 'user.getSuperAdminAccess()'
  15. ),
  16. ],
  17. processor: OrganizationCreationRequestProcessor::class
  18. )]
  19. class OrganizationCreationRequest
  20. {
  21. /**
  22. * Id 'bidon' ajouté par défaut pour permettre la construction
  23. * de l'IRI par api platform.
  24. */
  25. #[ApiProperty(identifier: true)]
  26. private int $id = 0;
  27. private string $name;
  28. private LegalEnum $legalStatus;
  29. private SettingsProductEnum $product;
  30. private string $streetAddress1;
  31. private ?string $streetAddress2 = null;
  32. private ?string $streetAddress3 = null;
  33. private string $postalCode;
  34. private string $city;
  35. private int $countryId = 72; // France's id
  36. private string $phoneNumber;
  37. private string $email;
  38. private string $subdomain;
  39. private int $parentId;
  40. private int $networkId;
  41. private PrincipalTypeEnum $principalType;
  42. private ?OrganizationMemberCreationRequest $president = null;
  43. private ?OrganizationMemberCreationRequest $director = null;
  44. private bool $createWebsite = true;
  45. public function getId(): int
  46. {
  47. return $this->id;
  48. }
  49. public function setId(int $id): self
  50. {
  51. $this->id = $id;
  52. return $this;
  53. }
  54. public function getName(): string
  55. {
  56. return $this->name;
  57. }
  58. public function setName(string $name): self
  59. {
  60. $this->name = $name;
  61. return $this;
  62. }
  63. public function getLegalStatus(): LegalEnum
  64. {
  65. return $this->legalStatus;
  66. }
  67. public function setLegalStatus(LegalEnum $legalStatus): self
  68. {
  69. $this->legalStatus = $legalStatus;
  70. return $this;
  71. }
  72. public function getProduct(): SettingsProductEnum
  73. {
  74. return $this->product;
  75. }
  76. public function setProduct(SettingsProductEnum $product): self
  77. {
  78. $this->product = $product;
  79. return $this;
  80. }
  81. public function getStreetAddress1(): string
  82. {
  83. return $this->streetAddress1;
  84. }
  85. public function setStreetAddress1(string $streetAddress1): self
  86. {
  87. $this->streetAddress1 = $streetAddress1;
  88. return $this;
  89. }
  90. public function getStreetAddress2(): ?string
  91. {
  92. return $this->streetAddress2;
  93. }
  94. public function setStreetAddress2(?string $streetAddress2): self
  95. {
  96. $this->streetAddress2 = $streetAddress2;
  97. return $this;
  98. }
  99. public function getStreetAddress3(): ?string
  100. {
  101. return $this->streetAddress3;
  102. }
  103. public function setStreetAddress3(?string $streetAddress3): self
  104. {
  105. $this->streetAddress3 = $streetAddress3;
  106. return $this;
  107. }
  108. public function getPostalCode(): string
  109. {
  110. return $this->postalCode;
  111. }
  112. public function setPostalCode(string $postalCode): self
  113. {
  114. $this->postalCode = $postalCode;
  115. return $this;
  116. }
  117. public function getCity(): string
  118. {
  119. return $this->city;
  120. }
  121. public function setCity(string $city): self
  122. {
  123. $this->city = $city;
  124. return $this;
  125. }
  126. public function getCountryId(): int
  127. {
  128. return $this->countryId;
  129. }
  130. public function setCountryId(int $countryId): self
  131. {
  132. $this->countryId = $countryId;
  133. return $this;
  134. }
  135. public function getPhoneNumber(): string
  136. {
  137. return $this->phoneNumber;
  138. }
  139. public function setPhoneNumber(string $phoneNumber): self
  140. {
  141. $this->phoneNumber = $phoneNumber;
  142. return $this;
  143. }
  144. public function getEmail(): string
  145. {
  146. return $this->email;
  147. }
  148. public function setEmail(string $email): self
  149. {
  150. $this->email = $email;
  151. return $this;
  152. }
  153. public function getSubdomain(): string
  154. {
  155. return $this->subdomain;
  156. }
  157. public function setSubdomain(string $subdomain): self
  158. {
  159. $this->subdomain = $subdomain;
  160. return $this;
  161. }
  162. public function getParentId(): int
  163. {
  164. return $this->parentId;
  165. }
  166. public function setParentId(int $parentId): self
  167. {
  168. $this->parentId = $parentId;
  169. return $this;
  170. }
  171. public function getNetworkId(): int
  172. {
  173. return $this->networkId;
  174. }
  175. public function setNetworkId(int $networkId): self
  176. {
  177. $this->networkId = $networkId;
  178. return $this;
  179. }
  180. public function getPrincipalType(): PrincipalTypeEnum
  181. {
  182. return $this->principalType;
  183. }
  184. public function setPrincipalType(PrincipalTypeEnum $principalType): self
  185. {
  186. $this->principalType = $principalType;
  187. return $this;
  188. }
  189. public function getPresident(): ?OrganizationMemberCreationRequest
  190. {
  191. return $this->president;
  192. }
  193. public function setPresident(?OrganizationMemberCreationRequest $president): self
  194. {
  195. $this->president = $president;
  196. return $this;
  197. }
  198. public function getDirector(): ?OrganizationMemberCreationRequest
  199. {
  200. return $this->director;
  201. }
  202. public function setDirector(?OrganizationMemberCreationRequest $director): self
  203. {
  204. $this->director = $director;
  205. return $this;
  206. }
  207. public function getCreateWebsite(): bool
  208. {
  209. return $this->createWebsite;
  210. }
  211. public function setCreateWebsite(bool $createWebsite): self
  212. {
  213. $this->createWebsite = $createWebsite;
  214. return $this;
  215. }
  216. }