Parse and validate AT Protocol Lexicons with DTO generation for Laravel
1<?php
2
3namespace SocialDept\AtpSchema\Generated\Tools\Ozone\Moderation\Defs;
4
5use Carbon\Carbon;
6use SocialDept\AtpSchema\Data\Data;
7use SocialDept\AtpSchema\Support\UnionHelper;
8
9/**
10 * GENERATED CODE - DO NOT EDIT
11 *
12 * Lexicon: tools.ozone.moderation.defs.modEventView
13 * Type: object
14 *
15 * @property int $id
16 * @property mixed $event
17 * @property mixed $subject
18 * @property array<string> $subjectBlobCids
19 * @property string $createdBy
20 * @property Carbon $createdAt
21 * @property string|null $creatorHandle
22 * @property string|null $subjectHandle
23 * @property mixed $modTool
24 *
25 * Constraints:
26 * - Required: id, event, subject, subjectBlobCids, createdBy, createdAt
27 * - createdBy: Format: did
28 * - createdAt: Format: datetime
29 */
30class ModEventView extends Data
31{
32 public function __construct(
33 public readonly int $id,
34 public readonly mixed $event,
35 public readonly mixed $subject,
36 public readonly array $subjectBlobCids,
37 public readonly string $createdBy,
38 public readonly Carbon $createdAt,
39 public readonly ?string $creatorHandle = null,
40 public readonly ?string $subjectHandle = null,
41 public readonly mixed $modTool = null
42 ) {
43 }
44
45 /**
46 * Get the lexicon NSID for this data type.
47 *
48 * @return string
49 */
50 public static function getLexicon(): string
51 {
52 return 'tools.ozone.moderation.defs.modEventView';
53 }
54
55
56 /**
57 * Create an instance from an array.
58 *
59 * @param array $data The data array
60 * @return static
61 */
62 public static function fromArray(array $data): static
63 {
64 return new static(
65 id: $data['id'],
66 event: UnionHelper::validateOpenUnion($data['event']),
67 subject: UnionHelper::validateOpenUnion($data['subject']),
68 subjectBlobCids: $data['subjectBlobCids'],
69 createdBy: $data['createdBy'],
70 createdAt: Carbon::parse($data['createdAt']),
71 creatorHandle: $data['creatorHandle'] ?? null,
72 subjectHandle: $data['subjectHandle'] ?? null,
73 modTool: $data['modTool'] ?? null
74 );
75 }
76
77}