Parse and validate AT Protocol Lexicons with DTO generation for Laravel
at main 63 lines 1.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 * Logs a scheduled takedown action for an account. 12 * 13 * Lexicon: tools.ozone.moderation.defs.scheduleTakedownEvent 14 * Type: object 15 * 16 * @property string|null $comment 17 * @property Carbon|null $executeAt 18 * @property Carbon|null $executeAfter 19 * @property Carbon|null $executeUntil 20 * 21 * Constraints: 22 * - executeAt: Format: datetime 23 * - executeAfter: Format: datetime 24 * - executeUntil: Format: datetime 25 */ 26class ScheduleTakedownEvent extends Data 27{ 28 public function __construct( 29 public readonly ?string $comment = null, 30 public readonly ?Carbon $executeAt = null, 31 public readonly ?Carbon $executeAfter = null, 32 public readonly ?Carbon $executeUntil = null 33 ) { 34 } 35 36 /** 37 * Get the lexicon NSID for this data type. 38 * 39 * @return string 40 */ 41 public static function getLexicon(): string 42 { 43 return 'tools.ozone.moderation.defs.scheduleTakedownEvent'; 44 } 45 46 47 /** 48 * Create an instance from an array. 49 * 50 * @param array $data The data array 51 * @return static 52 */ 53 public static function fromArray(array $data): static 54 { 55 return new static( 56 comment: $data['comment'] ?? null, 57 executeAt: isset($data['executeAt']) ? Carbon::parse($data['executeAt']) : null, 58 executeAfter: isset($data['executeAfter']) ? Carbon::parse($data['executeAfter']) : null, 59 executeUntil: isset($data['executeUntil']) ? Carbon::parse($data['executeUntil']) : null 60 ); 61 } 62 63}