Parse and validate AT Protocol Lexicons with DTO generation for Laravel
at main 83 lines 3.7 kB view raw
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 * Take down a subject permanently or temporarily 12 * 13 * Lexicon: tools.ozone.moderation.defs.modEventTakedown 14 * Type: object 15 * 16 * @property string|null $comment 17 * @property int|null $durationInHours Indicates how long the takedown should be in effect before automatically expiring. 18 * @property bool|null $acknowledgeAccountSubjects If true, all other reports on content authored by this account will be resolved (acknowledged). 19 * @property array<string>|null $policies Names/Keywords of the policies that drove the decision. 20 * @property string|null $severityLevel Severity level of the violation (e.g., 'sev-0', 'sev-1', 'sev-2', etc.). 21 * @property array<string>|null $targetServices List of services where the takedown should be applied. If empty or not provided, takedown is applied on all configured services. 22 * @property int|null $strikeCount Number of strikes to assign to the user for this violation. 23 * @property Carbon|null $strikeExpiresAt When the strike should expire. If not provided, the strike never expires. 24 * 25 * Constraints: 26 * - policies: Max length: 5 27 * - strikeExpiresAt: Format: datetime 28 */ 29class ModEventTakedown extends Data 30{ 31 /** 32 * @param int|null $durationInHours Indicates how long the takedown should be in effect before automatically expiring. 33 * @param bool|null $acknowledgeAccountSubjects If true, all other reports on content authored by this account will be resolved (acknowledged). 34 * @param array<string>|null $policies Names/Keywords of the policies that drove the decision. 35 * @param string|null $severityLevel Severity level of the violation (e.g., 'sev-0', 'sev-1', 'sev-2', etc.). 36 * @param array<string>|null $targetServices List of services where the takedown should be applied. If empty or not provided, takedown is applied on all configured services. 37 * @param int|null $strikeCount Number of strikes to assign to the user for this violation. 38 * @param Carbon|null $strikeExpiresAt When the strike should expire. If not provided, the strike never expires. 39 */ 40 public function __construct( 41 public readonly ?string $comment = null, 42 public readonly ?int $durationInHours = null, 43 public readonly ?bool $acknowledgeAccountSubjects = null, 44 public readonly ?array $policies = null, 45 public readonly ?string $severityLevel = null, 46 public readonly ?array $targetServices = null, 47 public readonly ?int $strikeCount = null, 48 public readonly ?Carbon $strikeExpiresAt = null 49 ) { 50 } 51 52 /** 53 * Get the lexicon NSID for this data type. 54 * 55 * @return string 56 */ 57 public static function getLexicon(): string 58 { 59 return 'tools.ozone.moderation.defs.modEventTakedown'; 60 } 61 62 63 /** 64 * Create an instance from an array. 65 * 66 * @param array $data The data array 67 * @return static 68 */ 69 public static function fromArray(array $data): static 70 { 71 return new static( 72 comment: $data['comment'] ?? null, 73 durationInHours: $data['durationInHours'] ?? null, 74 acknowledgeAccountSubjects: $data['acknowledgeAccountSubjects'] ?? null, 75 policies: $data['policies'] ?? null, 76 severityLevel: $data['severityLevel'] ?? null, 77 targetServices: $data['targetServices'] ?? null, 78 strikeCount: $data['strikeCount'] ?? null, 79 strikeExpiresAt: isset($data['strikeExpiresAt']) ? Carbon::parse($data['strikeExpiresAt']) : null 80 ); 81 } 82 83}