Parse and validate AT Protocol Lexicons with DTO generation for Laravel
1<?php
2
3namespace SocialDept\AtpSchema\Contracts;
4
5/**
6 * Contract for Data classes that can participate in AT Protocol discriminated unions.
7 *
8 * Union types in AT Protocol use the $type field to discriminate between
9 * different variants. This interface marks classes that can be used as
10 * union variants and provides access to their discriminator value.
11 */
12interface DiscriminatedUnion
13{
14 /**
15 * Get the lexicon NSID that identifies this union variant.
16 *
17 * This value is used as the $type discriminator in AT Protocol records
18 * to identify which specific type a union contains.
19 */
20 public static function getDiscriminator(): string;
21}