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 * Keep a log of outgoing email to a user
12 *
13 * Lexicon: tools.ozone.moderation.defs.modEventEmail
14 * Type: object
15 *
16 * @property string $subjectLine The subject line of the email sent to the user.
17 * @property string|null $content The content of the email sent to the user.
18 * @property string|null $comment Additional comment about the outgoing comm.
19 * @property array<string>|null $policies Names/Keywords of the policies that necessitated the email.
20 * @property string|null $severityLevel Severity level of the violation. Normally 'sev-1' that adds strike on repeat offense
21 * @property int|null $strikeCount Number of strikes to assign to the user for this violation. Normally 0 as an indicator of a warning and only added as a strike on a repeat offense.
22 * @property Carbon|null $strikeExpiresAt When the strike should expire. If not provided, the strike never expires.
23 * @property bool|null $isDelivered Indicates whether the email was successfully delivered to the user's inbox.
24 *
25 * Constraints:
26 * - Required: subjectLine
27 * - policies: Max length: 5
28 * - strikeExpiresAt: Format: datetime
29 */
30class ModEventEmail extends Data
31{
32 /**
33 * @param string $subjectLine The subject line of the email sent to the user.
34 * @param string|null $content The content of the email sent to the user.
35 * @param string|null $comment Additional comment about the outgoing comm.
36 * @param array<string>|null $policies Names/Keywords of the policies that necessitated the email.
37 * @param string|null $severityLevel Severity level of the violation. Normally 'sev-1' that adds strike on repeat offense
38 * @param int|null $strikeCount Number of strikes to assign to the user for this violation. Normally 0 as an indicator of a warning and only added as a strike on a repeat offense.
39 * @param Carbon|null $strikeExpiresAt When the strike should expire. If not provided, the strike never expires.
40 * @param bool|null $isDelivered Indicates whether the email was successfully delivered to the user's inbox.
41 */
42 public function __construct(
43 public readonly string $subjectLine,
44 public readonly ?string $content = null,
45 public readonly ?string $comment = null,
46 public readonly ?array $policies = null,
47 public readonly ?string $severityLevel = null,
48 public readonly ?int $strikeCount = null,
49 public readonly ?Carbon $strikeExpiresAt = null,
50 public readonly ?bool $isDelivered = null
51 ) {
52 }
53
54 /**
55 * Get the lexicon NSID for this data type.
56 *
57 * @return string
58 */
59 public static function getLexicon(): string
60 {
61 return 'tools.ozone.moderation.defs.modEventEmail';
62 }
63
64
65 /**
66 * Create an instance from an array.
67 *
68 * @param array $data The data array
69 * @return static
70 */
71 public static function fromArray(array $data): static
72 {
73 return new static(
74 subjectLine: $data['subjectLine'],
75 content: $data['content'] ?? null,
76 comment: $data['comment'] ?? null,
77 policies: $data['policies'] ?? null,
78 severityLevel: $data['severityLevel'] ?? null,
79 strikeCount: $data['strikeCount'] ?? null,
80 strikeExpiresAt: isset($data['strikeExpiresAt']) ? Carbon::parse($data['strikeExpiresAt']) : null,
81 isDelivered: $data['isDelivered'] ?? null
82 );
83 }
84
85}