Parse and validate AT Protocol Lexicons with DTO generation for Laravel
at main 80 lines 2.9 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 * Age assurance info coming directly from users. Only works on DID subjects. 12 * 13 * Lexicon: tools.ozone.moderation.defs.ageAssuranceEvent 14 * Type: object 15 * 16 * @property Carbon $createdAt The date and time of this write operation. 17 * @property string $status The status of the age assurance process. 18 * @property string $attemptId The unique identifier for this instance of the age assurance flow, in UUID format. 19 * @property string|null $initIp The IP address used when initiating the AA flow. 20 * @property string|null $initUa The user agent used when initiating the AA flow. 21 * @property string|null $completeIp The IP address used when completing the AA flow. 22 * @property string|null $completeUa The user agent used when completing the AA flow. 23 * 24 * Constraints: 25 * - Required: createdAt, status, attemptId 26 * - createdAt: Format: datetime 27 */ 28class AgeAssuranceEvent extends Data 29{ 30 /** 31 * @param Carbon $createdAt The date and time of this write operation. 32 * @param string $status The status of the age assurance process. 33 * @param string $attemptId The unique identifier for this instance of the age assurance flow, in UUID format. 34 * @param string|null $initIp The IP address used when initiating the AA flow. 35 * @param string|null $initUa The user agent used when initiating the AA flow. 36 * @param string|null $completeIp The IP address used when completing the AA flow. 37 * @param string|null $completeUa The user agent used when completing the AA flow. 38 */ 39 public function __construct( 40 public readonly Carbon $createdAt, 41 public readonly string $status, 42 public readonly string $attemptId, 43 public readonly ?string $initIp = null, 44 public readonly ?string $initUa = null, 45 public readonly ?string $completeIp = null, 46 public readonly ?string $completeUa = null 47 ) { 48 } 49 50 /** 51 * Get the lexicon NSID for this data type. 52 * 53 * @return string 54 */ 55 public static function getLexicon(): string 56 { 57 return 'tools.ozone.moderation.defs.ageAssuranceEvent'; 58 } 59 60 61 /** 62 * Create an instance from an array. 63 * 64 * @param array $data The data array 65 * @return static 66 */ 67 public static function fromArray(array $data): static 68 { 69 return new static( 70 createdAt: Carbon::parse($data['createdAt']), 71 status: $data['status'], 72 attemptId: $data['attemptId'], 73 initIp: $data['initIp'] ?? null, 74 initUa: $data['initUa'] ?? null, 75 completeIp: $data['completeIp'] ?? null, 76 completeUa: $data['completeUa'] ?? null 77 ); 78 } 79 80}