7 changed files with 369 additions and 29 deletions
			
			
		@ -0,0 +1,97 @@ | 
				
			|||
<?php | 
				
			|||
 | 
				
			|||
namespace Auxilium\Schemas; | 
				
			|||
 | 
				
			|||
use Darksparrow\AuxiliumSchemaBuilder\Attributes\SchemaDocument; | 
				
			|||
use Darksparrow\AuxiliumSchemaBuilder\Attributes\SchemaDocumentField; | 
				
			|||
use Darksparrow\AuxiliumSchemaBuilder\Enumerators\SchemaFieldExistence; | 
				
			|||
 | 
				
			|||
#[SchemaDocument( | 
				
			|||
    Name: "case", | 
				
			|||
    Comment: "The case object itself SHOULD not have a value" | 
				
			|||
)] | 
				
			|||
class CaseSchema | 
				
			|||
{ | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "title", | 
				
			|||
        Existence: SchemaFieldExistence::SHOULD, | 
				
			|||
        Comment: "This SHOULD be a short description of what the case is about", | 
				
			|||
        MaxSize: 2048, | 
				
			|||
        MimeType: "text/plain", | 
				
			|||
    )] | 
				
			|||
    public string $Title; | 
				
			|||
 | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "clients", | 
				
			|||
        Existence: SchemaFieldExistence::SHOULD, | 
				
			|||
        Comment: "This SHOULD be an 'array node' of all the clients involved in the case", | 
				
			|||
        ValidSchemas: [ | 
				
			|||
            CollectionSchema::class, | 
				
			|||
        ], | 
				
			|||
        MaxSize: 0, | 
				
			|||
        Child: new SchemaDocumentField( | 
				
			|||
            Name: "clients", | 
				
			|||
            Comment: "", | 
				
			|||
            ValidSchemas: [ | 
				
			|||
                UserSchema::class, | 
				
			|||
            ] | 
				
			|||
        ), | 
				
			|||
    )] | 
				
			|||
    public array $Clients; | 
				
			|||
 | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "workers", | 
				
			|||
        Existence: SchemaFieldExistence::SHOULD, | 
				
			|||
        Comment: "This SHOULD be an 'array node' of all staff working on the case", | 
				
			|||
        ValidSchemas: [ | 
				
			|||
            CollectionSchema::class, | 
				
			|||
        ], | 
				
			|||
        MaxSize: 0, | 
				
			|||
        Child: new SchemaDocumentField( | 
				
			|||
            Name: "workers", | 
				
			|||
            Comment: "", | 
				
			|||
            ValidSchemas: [ | 
				
			|||
                UserSchema::class, | 
				
			|||
                OrganisationSchema::class, | 
				
			|||
            ] | 
				
			|||
        ), | 
				
			|||
    )] | 
				
			|||
    public array $Workers; | 
				
			|||
 | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "documents", | 
				
			|||
        Existence: SchemaFieldExistence::SHOULD, | 
				
			|||
        Comment: "This SHOULD be an 'array node' of all the case documents", | 
				
			|||
        ValidSchemas: [ | 
				
			|||
            CollectionSchema::class, | 
				
			|||
        ], | 
				
			|||
        MaxSize: 0, | 
				
			|||
        Child: new SchemaDocumentField( | 
				
			|||
            Name: "documents", | 
				
			|||
            Comment: "", | 
				
			|||
            ValidSchemas: [ | 
				
			|||
                DocumentSchema::class, | 
				
			|||
            ] | 
				
			|||
        ), | 
				
			|||
    )] | 
				
			|||
    public array $Documents; | 
				
			|||
 | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "messages", | 
				
			|||
        Existence: SchemaFieldExistence::SHOULD, | 
				
			|||
        Comment: "This SHOULD be an 'array node' of all messages that relate to this case", | 
				
			|||
        ValidSchemas: [ | 
				
			|||
            CollectionSchema::class, | 
				
			|||
        ], | 
				
			|||
        MaxSize: 0, | 
				
			|||
        Child: new SchemaDocumentField( | 
				
			|||
            Name: "messages", | 
				
			|||
            Comment: "", | 
				
			|||
            ValidSchemas: [ | 
				
			|||
                CollectionSchema::class, | 
				
			|||
            ] | 
				
			|||
        ), | 
				
			|||
    )] | 
				
			|||
    public array $Messages; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
@ -0,0 +1,15 @@ | 
				
			|||
<?php | 
				
			|||
 | 
				
			|||
namespace Auxilium\Schemas; | 
				
			|||
 | 
				
			|||
use Darksparrow\AuxiliumSchemaBuilder\Attributes\SchemaDocument; | 
				
			|||
 | 
				
			|||
#[SchemaDocument( | 
				
			|||
    Name: "collection", | 
				
			|||
    MaxSize: 0, | 
				
			|||
    Comment: "This is intended as an inheritable schema used to signify to software that it SHOULD display the numeric properties of this node as an inlined list", | 
				
			|||
)] | 
				
			|||
class CollectionSchema | 
				
			|||
{ | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,43 @@ | 
				
			|||
<?php | 
				
			|||
 | 
				
			|||
namespace Auxilium\Schemas; | 
				
			|||
 | 
				
			|||
use Darksparrow\AuxiliumSchemaBuilder\Attributes\SchemaDocument; | 
				
			|||
use Darksparrow\AuxiliumSchemaBuilder\Attributes\SchemaDocumentField; | 
				
			|||
use Darksparrow\AuxiliumSchemaBuilder\Enumerators\SchemaFieldExistence; | 
				
			|||
 | 
				
			|||
#[SchemaDocument( | 
				
			|||
    Name: "document", | 
				
			|||
    Comment: 	"Any given document SHOULD have metadata attached", | 
				
			|||
)] | 
				
			|||
class DocumentSchema | 
				
			|||
{ | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "file_name", | 
				
			|||
        Existence: SchemaFieldExistence::SHOULD, | 
				
			|||
        Comment: "The filename SHOULD NOT contain an extension, this SHOULD be added by the application based on the file's mime type", | 
				
			|||
        MaxSize: 256, | 
				
			|||
        MimeType: "text/plain", | 
				
			|||
    )] | 
				
			|||
    public string $FileName; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "created", | 
				
			|||
        Existence: SchemaFieldExistence::MAY, | 
				
			|||
        Comment: "The creation date, if supplied MUST be in ISO 8601 format", | 
				
			|||
        MaxSize: 64, | 
				
			|||
        MimeType: "text/plain", | 
				
			|||
    )] | 
				
			|||
    public string $Created; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "modified", | 
				
			|||
        Existence: SchemaFieldExistence::MAY, | 
				
			|||
        Comment: "The last modified date, if supplied MUST be in ISO 8601 format", | 
				
			|||
        MaxSize: 64, | 
				
			|||
        MimeType: "text/plain", | 
				
			|||
    )] | 
				
			|||
    public string $Modified; | 
				
			|||
} | 
				
			|||
@ -0,0 +1,14 @@ | 
				
			|||
<?php | 
				
			|||
 | 
				
			|||
namespace Auxilium\Schemas; | 
				
			|||
 | 
				
			|||
use Darksparrow\AuxiliumSchemaBuilder\Attributes\SchemaDocument; | 
				
			|||
 | 
				
			|||
#[SchemaDocument( | 
				
			|||
    Name: "enum", | 
				
			|||
    Comment: "This is intended as an inheritable schema used to signify to software that it SHOULD be interpreted as a enumerable choice value that can be decoded based on its schema", | 
				
			|||
)] | 
				
			|||
class EnumSchema | 
				
			|||
{ | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,169 @@ | 
				
			|||
<?php | 
				
			|||
 | 
				
			|||
namespace Auxilium\Schemas; | 
				
			|||
 | 
				
			|||
use Darksparrow\AuxiliumSchemaBuilder\Attributes\SchemaDocument; | 
				
			|||
use Darksparrow\AuxiliumSchemaBuilder\Attributes\SchemaDocumentField; | 
				
			|||
use Darksparrow\AuxiliumSchemaBuilder\Enumerators\SchemaFieldExistence; | 
				
			|||
 | 
				
			|||
#[SchemaDocument( | 
				
			|||
    Name: "user", | 
				
			|||
    MaxSize: 0, | 
				
			|||
    Comment: "The user object itself SHOULD not have a value", | 
				
			|||
)] | 
				
			|||
class UserSchema | 
				
			|||
{ | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "name", | 
				
			|||
        Existence: SchemaFieldExistence::MUST, | 
				
			|||
        Comment: "This MUST be the user's full name", | 
				
			|||
        MaxSize: 2048, | 
				
			|||
        MimeType: "text/plain", | 
				
			|||
    )] | 
				
			|||
    public string $Name; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "display_name", | 
				
			|||
        Existence: SchemaFieldExistence::SHOULD, | 
				
			|||
        Comment: "This SHOULD be the user's first name or 'preferred' name used for UI", | 
				
			|||
        MaxSize: 256, | 
				
			|||
        MimeType: "text/plain", | 
				
			|||
    )] | 
				
			|||
    public string $DisplayName; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "contact_email", | 
				
			|||
        Existence: SchemaFieldExistence::SHOULD, | 
				
			|||
        Comment: "This SHOULD NOT be used for unverified user input", | 
				
			|||
        MaxSize: 512, | 
				
			|||
        MimeType: "text/plain", | 
				
			|||
    )] | 
				
			|||
    public string $ContactEmail; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "contact_email", | 
				
			|||
        Existence: SchemaFieldExistence::MAY, | 
				
			|||
        Comment: "This SHOULD be used for unverified user input instead of the 'contact_email' field", | 
				
			|||
        ValidSchemas: [ | 
				
			|||
            CollectionSchema::class, | 
				
			|||
        ], | 
				
			|||
        MaxSize: 0, | 
				
			|||
        Child: new SchemaDocumentField( | 
				
			|||
            Name: "auxiliary_emails", | 
				
			|||
            MaxSize: 512, | 
				
			|||
            MimeType: "text/plain", | 
				
			|||
        ) | 
				
			|||
    )] | 
				
			|||
    public array $AuxiliaryEmails; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "contact_phone_number", | 
				
			|||
        Existence: SchemaFieldExistence::SHOULD, | 
				
			|||
        Comment: "This SHOULD include country code, and SHOULD NOT include spaces", | 
				
			|||
        MaxSize: 64, | 
				
			|||
        MimeType: "text/plain", | 
				
			|||
    )] | 
				
			|||
    public string $ContactPhoneNumber; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "auxiliary_phone_numbers", | 
				
			|||
        Existence: SchemaFieldExistence::MAY, | 
				
			|||
        Comment: "This SHOULD be used for phone numbers that need to be on record, but shouldn't be used for contact", | 
				
			|||
        ValidSchemas: [ | 
				
			|||
            CollectionSchema::class, | 
				
			|||
        ], | 
				
			|||
        MaxSize: 0, | 
				
			|||
        Child: new SchemaDocumentField( | 
				
			|||
            Name: "auxiliary_phone_numbers", | 
				
			|||
            Comment: "This SHOULD include country code, and SHOULD NOT include spaces", | 
				
			|||
            MaxSize: 64, | 
				
			|||
            MimeType: "text/plain", | 
				
			|||
        ) | 
				
			|||
    )] | 
				
			|||
    public array $AuxiliaryPhoneNumbers; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "contact_address", | 
				
			|||
        Existence: SchemaFieldExistence::SHOULD, | 
				
			|||
        Comment: "This SHOULD be a full address, suitable for international postage", | 
				
			|||
        MimeType: "text/plain", | 
				
			|||
    )] | 
				
			|||
    public string $ContactAddress; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "auxiliary_addresses", | 
				
			|||
        Existence: SchemaFieldExistence::MAY, | 
				
			|||
        Comment: "This SHOULD be used for addresses that need to be on record, but shouldn't be used for contact", | 
				
			|||
        ValidSchemas: [ | 
				
			|||
            CollectionSchema::class, | 
				
			|||
        ], | 
				
			|||
        MaxSize: 0, | 
				
			|||
        Child: new SchemaDocumentField( | 
				
			|||
            Name: "auxiliary_addresses", | 
				
			|||
            Comment: "This MAY be a full address, or a shortened address only suitable for local mail", | 
				
			|||
            MimeType: "text/plain", | 
				
			|||
        ) | 
				
			|||
    )] | 
				
			|||
    public array $AuxiliaryAddresses; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "documents", | 
				
			|||
        Existence: SchemaFieldExistence::SHOULD, | 
				
			|||
        Comment: "This SHOULD be an 'array node' of all the user's documents", | 
				
			|||
        ValidSchemas: [ | 
				
			|||
            CollectionSchema::class, | 
				
			|||
        ], | 
				
			|||
        MaxSize: 0, | 
				
			|||
        Child: new SchemaDocumentField( | 
				
			|||
            Name: "documents", | 
				
			|||
            ValidSchemas: [ | 
				
			|||
                DocumentSchema::class, | 
				
			|||
            ] | 
				
			|||
        ) | 
				
			|||
    )] | 
				
			|||
    public array $Documents; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "cases", | 
				
			|||
        Existence: SchemaFieldExistence::SHOULD, | 
				
			|||
        Comment: "This SHOULD be an 'array node' of all the cases the user is either directly working on or the client of", | 
				
			|||
        ValidSchemas: [ | 
				
			|||
            CollectionSchema::class, | 
				
			|||
        ], | 
				
			|||
        MaxSize: 0, | 
				
			|||
        Child: new SchemaDocumentField( | 
				
			|||
            Name: "cases", | 
				
			|||
            ValidSchemas: [ | 
				
			|||
                CaseSchema::class, | 
				
			|||
            ] | 
				
			|||
        ) | 
				
			|||
    )] | 
				
			|||
    public array $Cases; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    #[SchemaDocumentField( | 
				
			|||
        Name: "messages", | 
				
			|||
        Existence: SchemaFieldExistence::SHOULD, | 
				
			|||
        Comment: "This SHOULD be an 'array node' of all the user's send and recieved messages", | 
				
			|||
        ValidSchemas: [ | 
				
			|||
            CollectionSchema::class, | 
				
			|||
        ], | 
				
			|||
        MaxSize: 0, | 
				
			|||
        Child: new SchemaDocumentField( | 
				
			|||
            Name: "messages", | 
				
			|||
            ValidSchemas: [ | 
				
			|||
                MessageSchema::class, | 
				
			|||
            ] | 
				
			|||
        ) | 
				
			|||
    )] | 
				
			|||
    public array $Messages; | 
				
			|||
} | 
				
			|||
					Loading…
					
					
				
		Reference in new issue