|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace App\Helpers\MetaFormats\FormatDefinitions; |
| 4 | + |
| 5 | +use App\Helpers\MetaFormats\Attributes\Format; |
| 6 | +use App\Helpers\MetaFormats\MetaFormat; |
| 7 | +use App\Helpers\MetaFormats\Attributes\FPost; |
| 8 | +use App\Helpers\MetaFormats\Validators\VArray; |
| 9 | +use App\Helpers\MetaFormats\Validators\VBool; |
| 10 | +use App\Helpers\MetaFormats\Validators\VEmail; |
| 11 | +use App\Helpers\MetaFormats\Validators\VMixed; |
| 12 | +use App\Helpers\MetaFormats\Validators\VString; |
| 13 | +use App\Helpers\MetaFormats\Validators\VUuid; |
| 14 | +use ArrayAccess; |
| 15 | + |
| 16 | +/** |
| 17 | + * Format definition used by the RegistrationPresenter::actionCreateInvitation endpoint. |
| 18 | + */ |
| 19 | +#[Format(GroupFormat::class)] |
| 20 | +class GroupFormat extends MetaFormat// implements ArrayAccess |
| 21 | +{ |
| 22 | + #[FPost(new VUuid(), "An identifier of the group")] |
| 23 | + public string $id; |
| 24 | + |
| 25 | + #[FPost( |
| 26 | + new VString(), |
| 27 | + "An informative, human readable identifier of the group", |
| 28 | + required: false, |
| 29 | + nullable: true, |
| 30 | + )] |
| 31 | + public ?string $externalId; |
| 32 | + |
| 33 | + #[FPost( |
| 34 | + new VBool(), |
| 35 | + "Whether the group is organizational (no assignments nor students).", |
| 36 | + required: false, |
| 37 | + )] |
| 38 | + public ?bool $organizational; |
| 39 | + |
| 40 | + #[FPost(new VBool(), "Whether the group is an exam group.", required: false)] |
| 41 | + public ?bool $exam; |
| 42 | + |
| 43 | + #[FPost(new VBool(), "Whether the group is archived", required: false)] |
| 44 | + public ?bool $archived; |
| 45 | + |
| 46 | + #[FPost(new VBool(), "Should the group be visible to all student?")] |
| 47 | + public ?bool $public; |
| 48 | + |
| 49 | + #[FPost(new VBool(), "Whether the group was explicitly marked as archived")] |
| 50 | + public ?bool $directlyArchived; |
| 51 | + |
| 52 | + #[FPost(new VArray(), "Localized names and descriptions", required: false)] |
| 53 | + public ?array $localizedTexts; |
| 54 | + |
| 55 | + #[FPost(new VArray(new VUuid()), "IDs of users which are explicitly listed as direct admins of this group")] |
| 56 | + public ?array $primaryAdminsIds; |
| 57 | + |
| 58 | + #[FPost( |
| 59 | + new VUuid(), |
| 60 | + "Identifier of the parent group (absent for a top-level group)", |
| 61 | + required: false, |
| 62 | + )] |
| 63 | + public ?string $parentGroupId; |
| 64 | + |
| 65 | + #[FPost(new VArray(new VUuid()), "Identifications of groups in descending order.")] |
| 66 | + public ?array $parentGroupsIds; |
| 67 | + |
| 68 | + #[FPost(new VArray(new VUuid()), "Identifications of child groups.")] |
| 69 | + public ?array $childGroups; |
| 70 | + |
| 71 | + #[FPost(new VMixed(), "")] |
| 72 | + public mixed $privateData; |
| 73 | + |
| 74 | + #[FPost(new VArray(), "")] |
| 75 | + public ?array $permissionHints; |
| 76 | + |
| 77 | + |
| 78 | + // public function offsetExists(mixed $offset): bool |
| 79 | + // { |
| 80 | + // return isset($this->$offset); |
| 81 | + // } |
| 82 | + |
| 83 | + // /** |
| 84 | + // * Offset to retrieve |
| 85 | + // * @param mixed $offset The offset to retrieve. |
| 86 | + // * @return mixed Can return all value types. |
| 87 | + // */ |
| 88 | + // public function offsetGet(mixed $offset): mixed |
| 89 | + // { |
| 90 | + // return $this->$offset ?? null; |
| 91 | + // } |
| 92 | + |
| 93 | + // /** |
| 94 | + // * Offset to set |
| 95 | + // * @param mixed $offset The offset to assign the value to. |
| 96 | + // * @param mixed $value The value to set. |
| 97 | + // */ |
| 98 | + // public function offsetSet(mixed $offset, mixed $value): void |
| 99 | + // { |
| 100 | + // $this->$offset = $value; |
| 101 | + // } |
| 102 | + |
| 103 | + // /** |
| 104 | + // * Offset to unset |
| 105 | + // * @param mixed $offset The offset to unset. |
| 106 | + // */ |
| 107 | + // public function offsetUnset(mixed $offset): void |
| 108 | + // { |
| 109 | + // $this->$offset = null; |
| 110 | + // } |
| 111 | +} |
0 commit comments