Parse and validate AT Protocol Lexicons with DTO generation for Laravel
1<?php
2
3namespace SocialDept\AtpSchema\Generated\Tools\Ozone\Moderation\Defs;
4
5use SocialDept\AtpSchema\Data\Data;
6
7/**
8 * GENERATED CODE - DO NOT EDIT
9 *
10 * Apply/Negate labels on a subject
11 *
12 * Lexicon: tools.ozone.moderation.defs.modEventLabel
13 * Type: object
14 *
15 * @property string|null $comment
16 * @property array<string> $createLabelVals
17 * @property array<string> $negateLabelVals
18 * @property int|null $durationInHours Indicates how long the label will remain on the subject. Only applies on labels that are being added.
19 *
20 * Constraints:
21 * - Required: createLabelVals, negateLabelVals
22 */
23class ModEventLabel extends Data
24{
25 /**
26 * @param int|null $durationInHours Indicates how long the label will remain on the subject. Only applies on labels that are being added.
27 */
28 public function __construct(
29 public readonly array $createLabelVals,
30 public readonly array $negateLabelVals,
31 public readonly ?string $comment = null,
32 public readonly ?int $durationInHours = null
33 ) {
34 }
35
36 /**
37 * Get the lexicon NSID for this data type.
38 *
39 * @return string
40 */
41 public static function getLexicon(): string
42 {
43 return 'tools.ozone.moderation.defs.modEventLabel';
44 }
45
46
47 /**
48 * Create an instance from an array.
49 *
50 * @param array $data The data array
51 * @return static
52 */
53 public static function fromArray(array $data): static
54 {
55 return new static(
56 createLabelVals: $data['createLabelVals'],
57 negateLabelVals: $data['negateLabelVals'],
58 comment: $data['comment'] ?? null,
59 durationInHours: $data['durationInHours'] ?? null
60 );
61 }
62
63}