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 * Logs identity related events on a repo subject. Normally captured by automod
12 * from the firehose and emitted to ozone for historical tracking.
13 *
14 * Lexicon: tools.ozone.moderation.defs.identityEvent
15 * Type: object
16 *
17 * @property string|null $comment
18 * @property string|null $handle
19 * @property string|null $pdsHost
20 * @property bool|null $tombstone
21 * @property Carbon $timestamp
22 *
23 * Constraints:
24 * - Required: timestamp
25 * - handle: Format: handle
26 * - pdsHost: Format: uri
27 * - timestamp: Format: datetime
28 */
29class IdentityEvent extends Data
30{
31 public function __construct(
32 public readonly Carbon $timestamp,
33 public readonly ?string $comment = null,
34 public readonly ?string $handle = null,
35 public readonly ?string $pdsHost = null,
36 public readonly ?bool $tombstone = null
37 ) {
38 }
39
40 /**
41 * Get the lexicon NSID for this data type.
42 *
43 * @return string
44 */
45 public static function getLexicon(): string
46 {
47 return 'tools.ozone.moderation.defs.identityEvent';
48 }
49
50
51 /**
52 * Create an instance from an array.
53 *
54 * @param array $data The data array
55 * @return static
56 */
57 public static function fromArray(array $data): static
58 {
59 return new static(
60 timestamp: Carbon::parse($data['timestamp']),
61 comment: $data['comment'] ?? null,
62 handle: $data['handle'] ?? null,
63 pdsHost: $data['pdsHost'] ?? null,
64 tombstone: $data['tombstone'] ?? null
65 );
66 }
67
68}