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