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