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;
7
8/**
9 * GENERATED CODE - DO NOT EDIT
10 *
11 * View of a scheduled moderation action
12 *
13 * Lexicon: tools.ozone.moderation.defs.scheduledActionView
14 * Type: object
15 *
16 * @property int $id Auto-incrementing row ID
17 * @property string $action Type of action to be executed
18 * @property mixed $eventData Serialized event object that will be propagated to the event when performed
19 * @property string $did Subject DID for the action
20 * @property Carbon|null $executeAt Exact time to execute the action
21 * @property Carbon|null $executeAfter Earliest time to execute the action (for randomized scheduling)
22 * @property Carbon|null $executeUntil Latest time to execute the action (for randomized scheduling)
23 * @property bool|null $randomizeExecution Whether execution time should be randomized within the specified range
24 * @property string $createdBy DID of the user who created this scheduled action
25 * @property Carbon $createdAt When the scheduled action was created
26 * @property Carbon|null $updatedAt When the scheduled action was last updated
27 * @property string $status Current status of the scheduled action
28 * @property Carbon|null $lastExecutedAt When the action was last attempted to be executed
29 * @property string|null $lastFailureReason Reason for the last execution failure
30 * @property int|null $executionEventId ID of the moderation event created when action was successfully executed
31 *
32 * Constraints:
33 * - Required: id, action, did, createdBy, createdAt, status
34 * - did: Format: did
35 * - executeAt: Format: datetime
36 * - executeAfter: Format: datetime
37 * - executeUntil: Format: datetime
38 * - createdBy: Format: did
39 * - createdAt: Format: datetime
40 * - updatedAt: Format: datetime
41 * - lastExecutedAt: Format: datetime
42 */
43class ScheduledActionView extends Data
44{
45 /**
46 * @param int $id Auto-incrementing row ID
47 * @param string $action Type of action to be executed
48 * @param string $did Subject DID for the action
49 * @param string $createdBy DID of the user who created this scheduled action
50 * @param Carbon $createdAt When the scheduled action was created
51 * @param string $status Current status of the scheduled action
52 * @param mixed $eventData Serialized event object that will be propagated to the event when performed
53 * @param Carbon|null $executeAt Exact time to execute the action
54 * @param Carbon|null $executeAfter Earliest time to execute the action (for randomized scheduling)
55 * @param Carbon|null $executeUntil Latest time to execute the action (for randomized scheduling)
56 * @param bool|null $randomizeExecution Whether execution time should be randomized within the specified range
57 * @param Carbon|null $updatedAt When the scheduled action was last updated
58 * @param Carbon|null $lastExecutedAt When the action was last attempted to be executed
59 * @param string|null $lastFailureReason Reason for the last execution failure
60 * @param int|null $executionEventId ID of the moderation event created when action was successfully executed
61 */
62 public function __construct(
63 public readonly int $id,
64 public readonly string $action,
65 public readonly string $did,
66 public readonly string $createdBy,
67 public readonly Carbon $createdAt,
68 public readonly string $status,
69 public readonly mixed $eventData = null,
70 public readonly ?Carbon $executeAt = null,
71 public readonly ?Carbon $executeAfter = null,
72 public readonly ?Carbon $executeUntil = null,
73 public readonly ?bool $randomizeExecution = null,
74 public readonly ?Carbon $updatedAt = null,
75 public readonly ?Carbon $lastExecutedAt = null,
76 public readonly ?string $lastFailureReason = null,
77 public readonly ?int $executionEventId = null
78 ) {
79 }
80
81 /**
82 * Get the lexicon NSID for this data type.
83 *
84 * @return string
85 */
86 public static function getLexicon(): string
87 {
88 return 'tools.ozone.moderation.defs.scheduledActionView';
89 }
90
91
92 /**
93 * Create an instance from an array.
94 *
95 * @param array $data The data array
96 * @return static
97 */
98 public static function fromArray(array $data): static
99 {
100 return new static(
101 id: $data['id'],
102 action: $data['action'],
103 did: $data['did'],
104 createdBy: $data['createdBy'],
105 createdAt: Carbon::parse($data['createdAt']),
106 status: $data['status'],
107 eventData: $data['eventData'] ?? null,
108 executeAt: isset($data['executeAt']) ? Carbon::parse($data['executeAt']) : null,
109 executeAfter: isset($data['executeAfter']) ? Carbon::parse($data['executeAfter']) : null,
110 executeUntil: isset($data['executeUntil']) ? Carbon::parse($data['executeUntil']) : null,
111 randomizeExecution: $data['randomizeExecution'] ?? null,
112 updatedAt: isset($data['updatedAt']) ? Carbon::parse($data['updatedAt']) : null,
113 lastExecutedAt: isset($data['lastExecutedAt']) ? Carbon::parse($data['lastExecutedAt']) : null,
114 lastFailureReason: $data['lastFailureReason'] ?? null,
115 executionEventId: $data['executionEventId'] ?? null
116 );
117 }
118
119}