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 * Lexicon: tools.ozone.moderation.defs.accountHosting
12 * Type: object
13 *
14 * @property string $status
15 * @property Carbon|null $updatedAt
16 * @property Carbon|null $createdAt
17 * @property Carbon|null $deletedAt
18 * @property Carbon|null $deactivatedAt
19 * @property Carbon|null $reactivatedAt
20 *
21 * Constraints:
22 * - Required: status
23 * - updatedAt: Format: datetime
24 * - createdAt: Format: datetime
25 * - deletedAt: Format: datetime
26 * - deactivatedAt: Format: datetime
27 * - reactivatedAt: Format: datetime
28 */
29class AccountHosting extends Data
30{
31 public function __construct(
32 public readonly string $status,
33 public readonly ?Carbon $updatedAt = null,
34 public readonly ?Carbon $createdAt = null,
35 public readonly ?Carbon $deletedAt = null,
36 public readonly ?Carbon $deactivatedAt = null,
37 public readonly ?Carbon $reactivatedAt = null
38 ) {
39 }
40
41 /**
42 * Get the lexicon NSID for this data type.
43 *
44 * @return string
45 */
46 public static function getLexicon(): string
47 {
48 return 'tools.ozone.moderation.defs.accountHosting';
49 }
50
51
52 /**
53 * Create an instance from an array.
54 *
55 * @param array $data The data array
56 * @return static
57 */
58 public static function fromArray(array $data): static
59 {
60 return new static(
61 status: $data['status'],
62 updatedAt: isset($data['updatedAt']) ? Carbon::parse($data['updatedAt']) : null,
63 createdAt: isset($data['createdAt']) ? Carbon::parse($data['createdAt']) : null,
64 deletedAt: isset($data['deletedAt']) ? Carbon::parse($data['deletedAt']) : null,
65 deactivatedAt: isset($data['deactivatedAt']) ? Carbon::parse($data['deactivatedAt']) : null,
66 reactivatedAt: isset($data['reactivatedAt']) ? Carbon::parse($data['reactivatedAt']) : null
67 );
68 }
69
70}