Cerys
6 months ago
1 changed files with 62 additions and 0 deletions
@ -0,0 +1,62 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace Darksparrow\Deegraph\Examples\SchemaBuilder\Schemas; |
||||
|
require_once __DIR__ . "/../../../vendor/autoload.php"; |
||||
|
|
||||
|
use Darksparrow\DeegraphPHP\Enumerators\SchemaFieldExistence; |
||||
|
use Darksparrow\DeegraphPHP\SchemaBuilder\Attributes\SchemaDocument; |
||||
|
use Darksparrow\DeegraphPHP\SchemaBuilder\Attributes\SchemaDocumentField; |
||||
|
|
||||
|
#[SchemaDocument( |
||||
|
Name: "Message", |
||||
|
MimeType: "message/rfc822", |
||||
|
)] |
||||
|
class Message |
||||
|
{ |
||||
|
#[SchemaDocumentField( |
||||
|
Name: "sender", |
||||
|
Existence: SchemaFieldExistence::SHOULD, |
||||
|
Comment: "The sender should be attached to a user object if known", |
||||
|
ValidSchemas: [ |
||||
|
"https://schemas.auxiliumsoftware.co.uk/v1/user.json" |
||||
|
], |
||||
|
)] |
||||
|
public string $Sender; |
||||
|
|
||||
|
#[SchemaDocumentField( |
||||
|
Name: "recipients", |
||||
|
Existence: SchemaFieldExistence::SHOULD, |
||||
|
Comment: "All direct recipients that are known should be attached", |
||||
|
ValidSchemas: [ |
||||
|
"https://schemas.auxiliumsoftware.co.uk/v1/collection.json" |
||||
|
], |
||||
|
MaxSize: 0, |
||||
|
)] |
||||
|
public string $Recipients; |
||||
|
|
||||
|
#[SchemaDocumentField( |
||||
|
Name: "indirect_recipients", |
||||
|
Existence: SchemaFieldExistence::SHOULD, |
||||
|
Comment: "All cc'd recipients that are known should be attached", |
||||
|
ValidSchemas: [ |
||||
|
"https://schemas.auxiliumsoftware.co.uk/v1/collection.json" |
||||
|
], |
||||
|
MaxSize: 0, |
||||
|
Child: [ |
||||
|
"@comment"=>"All direct recipients should be addressed", |
||||
|
"@valid_schemas"=>[ |
||||
|
"https://schemas.auxiliumsoftware.co.uk/v1/user.json" |
||||
|
] |
||||
|
] |
||||
|
)] |
||||
|
public string $IndirectRecipients; |
||||
|
|
||||
|
#[SchemaDocumentField( |
||||
|
Name: "sent_at", |
||||
|
Existence: SchemaFieldExistence::SHOULD, |
||||
|
Comment: "The date the message was actually sent, if supplied MUST be in ISO 8601 format", |
||||
|
MaxSize: 64, |
||||
|
MimeType: "text/plain", |
||||
|
)] |
||||
|
public string $SentAt; |
||||
|
} |
Loading…
Reference in new issue