Parse and validate AT Protocol Lexicons with DTO generation for Laravel
at main 58 lines 1.4 kB view raw
1<?php 2 3namespace SocialDept\AtpSchema\Generated\Tools\Ozone\Moderation\Defs; 4 5use SocialDept\AtpSchema\Data\Data; 6 7/** 8 * GENERATED CODE - DO NOT EDIT 9 * 10 * Moderation tool information for tracing the source of the action 11 * 12 * Lexicon: tools.ozone.moderation.defs.modTool 13 * Type: object 14 * 15 * @property string $name Name/identifier of the source (e.g., 'automod', 'ozone/workspace') 16 * @property mixed $meta Additional arbitrary metadata about the source 17 * 18 * Constraints: 19 * - Required: name 20 */ 21class ModTool extends Data 22{ 23 /** 24 * @param string $name Name/identifier of the source (e.g., 'automod', 'ozone/workspace') 25 * @param mixed $meta Additional arbitrary metadata about the source 26 */ 27 public function __construct( 28 public readonly string $name, 29 public readonly mixed $meta = null 30 ) { 31 } 32 33 /** 34 * Get the lexicon NSID for this data type. 35 * 36 * @return string 37 */ 38 public static function getLexicon(): string 39 { 40 return 'tools.ozone.moderation.defs.modTool'; 41 } 42 43 44 /** 45 * Create an instance from an array. 46 * 47 * @param array $data The data array 48 * @return static 49 */ 50 public static function fromArray(array $data): static 51 { 52 return new static( 53 name: $data['name'], 54 meta: $data['meta'] ?? null 55 ); 56 } 57 58}