OrganizationProfile.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\ApiResources\Profile;
  4. use ApiPlatform\Metadata\ApiProperty;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use ApiPlatform\Metadata\Get;
  7. use App\ApiResources\ApiResourcesInterface;
  8. use App\Enum\Organization\LegalEnum;
  9. use App\Enum\Organization\PrincipalTypeEnum;
  10. use App\Enum\Organization\SettingsProductEnum;
  11. use Symfony\Component\Serializer\Annotation\Groups;
  12. use Symfony\Component\Validator\Constraints as Assert;
  13. /**
  14. * Classe resource qui contient les champs relatifs aux organizations présentent dans la requete my_profile.
  15. */
  16. #[ApiResource(
  17. operations: [
  18. new Get(),
  19. ]
  20. )]
  21. class OrganizationProfile implements ApiResourcesInterface
  22. {
  23. #[ApiProperty(identifier: true)]
  24. #[Groups('access_profile_read')]
  25. public ?int $id = null;
  26. #[Groups('access_profile_read')]
  27. private ?string $name = null;
  28. #[Groups('access_profile_read')]
  29. #[Assert\Type(type: SettingsProductEnum::class)]
  30. private ?SettingsProductEnum $product = null;
  31. #[Groups('access_profile_read')]
  32. #[Assert\Type(type: LegalEnum::class)]
  33. private ?LegalEnum $legalStatus = null;
  34. /** @var list<string> $networks */
  35. #[Groups('access_profile_read')]
  36. private array $networks = [];
  37. #[Groups('access_profile_read')]
  38. private ?string $website = null;
  39. /** @var list<string> $modules */
  40. #[Groups('access_profile_read')]
  41. private array $modules = [];
  42. #[Groups('access_profile_read')]
  43. private bool $hasChildren = false;
  44. /** @var list<OrganizationProfile> */
  45. #[Groups('access_profile_read')]
  46. private array $parents = [];
  47. #[Groups('access_profile_read')]
  48. private bool $showAdherentList = false;
  49. #[Groups('access_profile_read')]
  50. private ?int $currentYear = null;
  51. #[Groups('access_profile_read')]
  52. private ?int $parametersId = null;
  53. #[Groups('access_profile_read')]
  54. #[Assert\Type(type: PrincipalTypeEnum::class)]
  55. private ?PrincipalTypeEnum $principalType = null;
  56. #[Groups('access_profile_read')]
  57. private bool $trialActive = false;
  58. #[Groups('access_profile_read')]
  59. private ?int $trialCountDown = null;
  60. #[Groups('access_profile_read')]
  61. private ?SettingsProductEnum $productBeforeTrial = null;
  62. public function getId(): ?int
  63. {
  64. return $this->id;
  65. }
  66. public function setId(?int $id): self
  67. {
  68. $this->id = $id;
  69. return $this;
  70. }
  71. public function getName(): ?string
  72. {
  73. return $this->name;
  74. }
  75. public function setName(?string $name): self
  76. {
  77. $this->name = $name;
  78. return $this;
  79. }
  80. public function getProduct(): ?SettingsProductEnum
  81. {
  82. return $this->product;
  83. }
  84. public function setProduct(?SettingsProductEnum $product): self
  85. {
  86. $this->product = $product;
  87. return $this;
  88. }
  89. public function getLegalStatus(): ?LegalEnum
  90. {
  91. return $this->legalStatus;
  92. }
  93. public function setLegalStatus(?LegalEnum $legalStatus): self
  94. {
  95. $this->legalStatus = $legalStatus;
  96. return $this;
  97. }
  98. /**
  99. * @return list<string>
  100. */
  101. public function getNetworks(): array
  102. {
  103. return $this->networks;
  104. }
  105. public function addNetwork(?string $network): self
  106. {
  107. $this->networks[] = $network;
  108. return $this;
  109. }
  110. public function getWebsite(): ?string
  111. {
  112. return $this->website;
  113. }
  114. public function setWebsite(?string $website): self
  115. {
  116. $this->website = $website;
  117. return $this;
  118. }
  119. /**
  120. * @return list<string>
  121. */
  122. public function getModules(): array
  123. {
  124. $modules = $this->modules;
  125. return array_unique($modules);
  126. }
  127. /**
  128. * @param list<string> $modules
  129. *
  130. * @return $this
  131. */
  132. public function setModules(array $modules): self
  133. {
  134. $this->modules = $modules;
  135. return $this;
  136. }
  137. public function getHasChildren(): bool
  138. {
  139. return $this->hasChildren;
  140. }
  141. public function setHasChildren(bool $hasChildren): self
  142. {
  143. $this->hasChildren = $hasChildren;
  144. return $this;
  145. }
  146. /**
  147. * @return list<OrganizationProfile>
  148. */
  149. public function getParents(): array
  150. {
  151. return $this->parents;
  152. }
  153. public function addParent(OrganizationProfile $parent): self
  154. {
  155. $this->parents[] = $parent;
  156. return $this;
  157. }
  158. public function getShowAdherentList(): bool
  159. {
  160. return $this->showAdherentList;
  161. }
  162. public function setShowAdherentList(bool $showAdherentList): self
  163. {
  164. $this->showAdherentList = $showAdherentList;
  165. return $this;
  166. }
  167. public function getCurrentYear(): ?int
  168. {
  169. return $this->currentYear;
  170. }
  171. public function setCurrentYear(?int $currentYear): self
  172. {
  173. $this->currentYear = $currentYear;
  174. return $this;
  175. }
  176. public function getParametersId(): ?int
  177. {
  178. return $this->parametersId;
  179. }
  180. public function setParametersId(?int $parametersId): self
  181. {
  182. $this->parametersId = $parametersId;
  183. return $this;
  184. }
  185. public function getPrincipalType(): ?PrincipalTypeEnum
  186. {
  187. return $this->principalType;
  188. }
  189. public function setPrincipalType(?PrincipalTypeEnum $principalType): self
  190. {
  191. $this->principalType = $principalType;
  192. return $this;
  193. }
  194. public function isTrialActive(): bool
  195. {
  196. return $this->trialActive;
  197. }
  198. public function setTrialActive(bool $trialActive): self
  199. {
  200. $this->trialActive = $trialActive;
  201. return $this;
  202. }
  203. public function getTrialCountDown(): ?int
  204. {
  205. return $this->trialCountDown;
  206. }
  207. public function setTrialCountDown(?int $trialCountDown): self
  208. {
  209. $this->trialCountDown = $trialCountDown;
  210. return $this;
  211. }
  212. public function getProductBeforeTrial(): ?SettingsProductEnum
  213. {
  214. return $this->productBeforeTrial;
  215. }
  216. public function setProductBeforeTrial(?SettingsProductEnum $productBeforeTrial): self
  217. {
  218. $this->productBeforeTrial = $productBeforeTrial;
  219. return $this;
  220. }
  221. }