BazeField Services

<back to all web services

GetAllocation

Allocations API
Requires Authentication
The following routes are available for this service:
GET/allocations/{Id}
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


class AlarmCode implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $eventNumber=0,
        /** @var int|null */
        public ?int $parameter1=null,
        /** @var string|null */
        public ?string $vendorEventType=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['eventNumber'])) $this->eventNumber = $o['eventNumber'];
        if (isset($o['parameter1'])) $this->parameter1 = $o['parameter1'];
        if (isset($o['vendorEventType'])) $this->vendorEventType = $o['vendorEventType'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->eventNumber)) $o['eventNumber'] = $this->eventNumber;
        if (isset($this->parameter1)) $o['parameter1'] = $this->parameter1;
        if (isset($this->vendorEventType)) $o['vendorEventType'] = $this->vendorEventType;
        return empty($o) ? new class(){} : $o;
    }
}

class Alarm implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        /** @var int */
        public int $code=0,
        /** @var AlarmCode|null */
        public ?AlarmCode $alarmCode=null,
        /** @var string|null */
        public ?string $name=null,
        /** @var int */
        public int $brakePrg=0,
        /** @var bool|null */
        public ?bool $canTriggerAllocation=null,
        /** @var string|null */
        public ?string $description=null,
        /** @var string|null */
        public ?string $remarks=null,
        /** @var string */
        public string $resetPrg='',
        /** @var bool|null */
        public ?bool $isOkAlarm=null,
        /** @var array<string,string>|null */
        public ?array $meta=null,
        /** @var int */
        public int $alarmType=0,
        /** @var string|null */
        public ?string $type=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['code'])) $this->code = $o['code'];
        if (isset($o['alarmCode'])) $this->alarmCode = JsonConverters::from('AlarmCode', $o['alarmCode']);
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['brakePrg'])) $this->brakePrg = $o['brakePrg'];
        if (isset($o['canTriggerAllocation'])) $this->canTriggerAllocation = $o['canTriggerAllocation'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['remarks'])) $this->remarks = $o['remarks'];
        if (isset($o['resetPrg'])) $this->resetPrg = $o['resetPrg'];
        if (isset($o['isOkAlarm'])) $this->isOkAlarm = $o['isOkAlarm'];
        if (isset($o['meta'])) $this->meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['meta']);
        if (isset($o['alarmType'])) $this->alarmType = $o['alarmType'];
        if (isset($o['type'])) $this->type = $o['type'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->code)) $o['code'] = $this->code;
        if (isset($this->alarmCode)) $o['alarmCode'] = JsonConverters::to('AlarmCode', $this->alarmCode);
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->brakePrg)) $o['brakePrg'] = $this->brakePrg;
        if (isset($this->canTriggerAllocation)) $o['canTriggerAllocation'] = $this->canTriggerAllocation;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->remarks)) $o['remarks'] = $this->remarks;
        if (isset($this->resetPrg)) $o['resetPrg'] = $this->resetPrg;
        if (isset($this->isOkAlarm)) $o['isOkAlarm'] = $this->isOkAlarm;
        if (isset($this->meta)) $o['meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->meta);
        if (isset($this->alarmType)) $o['alarmType'] = $this->alarmType;
        if (isset($this->type)) $o['type'] = $this->type;
        return empty($o) ? new class(){} : $o;
    }
}

class TriggerAlarm implements JsonSerializable
{
    public function __construct(
        /** @var Alarm|null */
        public ?Alarm $alarm=null,
        /** @var DateTime */
        public DateTime $start=new DateTime(),
        /** @var DateTime|null */
        public ?DateTime $end=null,
        /** @var int */
        public int $logId=0,
        /** @var string|null */
        public ?string $sfId=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['alarm'])) $this->alarm = JsonConverters::from('Alarm', $o['alarm']);
        if (isset($o['start'])) $this->start = JsonConverters::from('DateTime', $o['start']);
        if (isset($o['end'])) $this->end = JsonConverters::from('DateTime', $o['end']);
        if (isset($o['logId'])) $this->logId = $o['logId'];
        if (isset($o['sfId'])) $this->sfId = $o['sfId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->alarm)) $o['alarm'] = JsonConverters::to('Alarm', $this->alarm);
        if (isset($this->start)) $o['start'] = JsonConverters::to('DateTime', $this->start);
        if (isset($this->end)) $o['end'] = JsonConverters::to('DateTime', $this->end);
        if (isset($this->logId)) $o['logId'] = $this->logId;
        if (isset($this->sfId)) $o['sfId'] = $this->sfId;
        return empty($o) ? new class(){} : $o;
    }
}

class AllocationCategory implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        /** @var string|null */
        public ?string $name=null,
        /** @var string|null */
        public ?string $acronym=null,
        /** @var string|null */
        public ?string $color=null,
        /** @var bool|null */
        public ?bool $uncategorized=null,
        /** @var bool|null */
        public ?bool $available=null,
        /** @var int */
        public int $typeId=0,
        /** @var string|null */
        public ?string $group=null,
        /** @var int */
        public int $sortIndex=0,
        /** @var int */
        public int $priority=0,
        /** @var bool|null */
        public ?bool $enabled=null,
        /** @var int */
        public int $performance=0,
        /** @var int */
        public int $excluded=0,
        /** @var int|null */
        public ?int $parentCategoryId=null,
        /** @var string|null */
        public ?string $parentCategoryName=null,
        /** @var string|null */
        public ?string $code=null,
        /** @var string|null */
        public ?string $variantAlias=null,
        /** @var array<string,string>|null */
        public ?array $attributes=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['acronym'])) $this->acronym = $o['acronym'];
        if (isset($o['color'])) $this->color = $o['color'];
        if (isset($o['uncategorized'])) $this->uncategorized = $o['uncategorized'];
        if (isset($o['available'])) $this->available = $o['available'];
        if (isset($o['typeId'])) $this->typeId = $o['typeId'];
        if (isset($o['group'])) $this->group = $o['group'];
        if (isset($o['sortIndex'])) $this->sortIndex = $o['sortIndex'];
        if (isset($o['priority'])) $this->priority = $o['priority'];
        if (isset($o['enabled'])) $this->enabled = $o['enabled'];
        if (isset($o['performance'])) $this->performance = $o['performance'];
        if (isset($o['excluded'])) $this->excluded = $o['excluded'];
        if (isset($o['parentCategoryId'])) $this->parentCategoryId = $o['parentCategoryId'];
        if (isset($o['parentCategoryName'])) $this->parentCategoryName = $o['parentCategoryName'];
        if (isset($o['code'])) $this->code = $o['code'];
        if (isset($o['variantAlias'])) $this->variantAlias = $o['variantAlias'];
        if (isset($o['attributes'])) $this->attributes = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['attributes']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->acronym)) $o['acronym'] = $this->acronym;
        if (isset($this->color)) $o['color'] = $this->color;
        if (isset($this->uncategorized)) $o['uncategorized'] = $this->uncategorized;
        if (isset($this->available)) $o['available'] = $this->available;
        if (isset($this->typeId)) $o['typeId'] = $this->typeId;
        if (isset($this->group)) $o['group'] = $this->group;
        if (isset($this->sortIndex)) $o['sortIndex'] = $this->sortIndex;
        if (isset($this->priority)) $o['priority'] = $this->priority;
        if (isset($this->enabled)) $o['enabled'] = $this->enabled;
        if (isset($this->performance)) $o['performance'] = $this->performance;
        if (isset($this->excluded)) $o['excluded'] = $this->excluded;
        if (isset($this->parentCategoryId)) $o['parentCategoryId'] = $this->parentCategoryId;
        if (isset($this->parentCategoryName)) $o['parentCategoryName'] = $this->parentCategoryName;
        if (isset($this->code)) $o['code'] = $this->code;
        if (isset($this->variantAlias)) $o['variantAlias'] = $this->variantAlias;
        if (isset($this->attributes)) $o['attributes'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->attributes);
        return empty($o) ? new class(){} : $o;
    }
}

class AllocationType implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        /** @var string|null */
        public ?string $name=null,
        /** @var string|null */
        public ?string $acronym=null,
        /** @var string|null */
        public ?string $version=null,
        /** @var string|null */
        public ?string $description=null,
        /** @var int */
        public int $sortOrder=0,
        /** @var int|null */
        public ?int $linkedTypeId=null,
        /** @var bool|null */
        public ?bool $subType=null,
        /** @var string|null */
        public ?string $groupName=null,
        /** @var bool|null */
        public ?bool $defaultVisible=null,
        /** @var int|null */
        public ?int $domainId=null,
        /** @var bool|null */
        public ?bool $disabled=null,
        /** @var string|null */
        public ?string $matrix=null,
        /** @var bool|null */
        public ?bool $certified=null,
        /** @var int */
        public int $allocationTypeClassId=0,
        /** @var int|null */
        public ?int $variantOfAbstractTypeId=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['acronym'])) $this->acronym = $o['acronym'];
        if (isset($o['version'])) $this->version = $o['version'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['sortOrder'])) $this->sortOrder = $o['sortOrder'];
        if (isset($o['linkedTypeId'])) $this->linkedTypeId = $o['linkedTypeId'];
        if (isset($o['subType'])) $this->subType = $o['subType'];
        if (isset($o['groupName'])) $this->groupName = $o['groupName'];
        if (isset($o['defaultVisible'])) $this->defaultVisible = $o['defaultVisible'];
        if (isset($o['domainId'])) $this->domainId = $o['domainId'];
        if (isset($o['disabled'])) $this->disabled = $o['disabled'];
        if (isset($o['matrix'])) $this->matrix = $o['matrix'];
        if (isset($o['certified'])) $this->certified = $o['certified'];
        if (isset($o['allocationTypeClassId'])) $this->allocationTypeClassId = $o['allocationTypeClassId'];
        if (isset($o['variantOfAbstractTypeId'])) $this->variantOfAbstractTypeId = $o['variantOfAbstractTypeId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->acronym)) $o['acronym'] = $this->acronym;
        if (isset($this->version)) $o['version'] = $this->version;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->sortOrder)) $o['sortOrder'] = $this->sortOrder;
        if (isset($this->linkedTypeId)) $o['linkedTypeId'] = $this->linkedTypeId;
        if (isset($this->subType)) $o['subType'] = $this->subType;
        if (isset($this->groupName)) $o['groupName'] = $this->groupName;
        if (isset($this->defaultVisible)) $o['defaultVisible'] = $this->defaultVisible;
        if (isset($this->domainId)) $o['domainId'] = $this->domainId;
        if (isset($this->disabled)) $o['disabled'] = $this->disabled;
        if (isset($this->matrix)) $o['matrix'] = $this->matrix;
        if (isset($this->certified)) $o['certified'] = $this->certified;
        if (isset($this->allocationTypeClassId)) $o['allocationTypeClassId'] = $this->allocationTypeClassId;
        if (isset($this->variantOfAbstractTypeId)) $o['variantOfAbstractTypeId'] = $this->variantOfAbstractTypeId;
        return empty($o) ? new class(){} : $o;
    }
}

class AllocationCategoryWithType extends AllocationCategory implements JsonSerializable
{
    /**
     * @param int $id
     * @param string|null $name
     * @param string|null $acronym
     * @param string|null $color
     * @param bool|null $uncategorized
     * @param bool|null $available
     * @param int $typeId
     * @param string|null $group
     * @param int $sortIndex
     * @param int $priority
     * @param bool|null $enabled
     * @param int $performance
     * @param int $excluded
     * @param int|null $parentCategoryId
     * @param string|null $parentCategoryName
     * @param string|null $code
     * @param string|null $variantAlias
     * @param array<string,string>|null $attributes
     */
    public function __construct(
        int $id=0,
        ?string $name=null,
        ?string $acronym=null,
        ?string $color=null,
        ?bool $uncategorized=null,
        ?bool $available=null,
        int $typeId=0,
        ?string $group=null,
        int $sortIndex=0,
        int $priority=0,
        ?bool $enabled=null,
        int $performance=0,
        int $excluded=0,
        ?int $parentCategoryId=null,
        ?string $parentCategoryName=null,
        ?string $code=null,
        ?string $variantAlias=null,
        ?array $attributes=null,
        /** @var AllocationType|null */
        public ?AllocationType $allocationType=null
    ) {
        parent::__construct($id,$name,$acronym,$color,$uncategorized,$available,$typeId,$group,$sortIndex,$priority,$enabled,$performance,$excluded,$parentCategoryId,$parentCategoryName,$code,$variantAlias,$attributes);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['allocationType'])) $this->allocationType = JsonConverters::from('AllocationType', $o['allocationType']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->allocationType)) $o['allocationType'] = JsonConverters::to('AllocationType', $this->allocationType);
        return empty($o) ? new class(){} : $o;
    }
}

class AllocationPropertyValue implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $name=null,
        /** @var string|null */
        public ?string $displayName=null,
        /** @var float */
        public float $value=0.0,
        /** @var float|null */
        public ?float $limitedValue=null,
        /** @var string|null */
        public ?string $unit=null,
        /** @var bool|null */
        public ?bool $isOverride=null,
        /** @var string|null */
        public ?string $description=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['displayName'])) $this->displayName = $o['displayName'];
        if (isset($o['value'])) $this->value = $o['value'];
        if (isset($o['limitedValue'])) $this->limitedValue = $o['limitedValue'];
        if (isset($o['unit'])) $this->unit = $o['unit'];
        if (isset($o['isOverride'])) $this->isOverride = $o['isOverride'];
        if (isset($o['description'])) $this->description = $o['description'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->displayName)) $o['displayName'] = $this->displayName;
        if (isset($this->value)) $o['value'] = $this->value;
        if (isset($this->limitedValue)) $o['limitedValue'] = $this->limitedValue;
        if (isset($this->unit)) $o['unit'] = $this->unit;
        if (isset($this->isOverride)) $o['isOverride'] = $this->isOverride;
        if (isset($this->description)) $o['description'] = $this->description;
        return empty($o) ? new class(){} : $o;
    }
}

enum CommentType : string
{
    case Turbine = 'Turbine';
    case Allocation = 'Allocation';
    case Alarm = 'Alarm';
}

enum LabelType : int
{
    case Allocation = 1;
    case Other = 2;
    case Alarm = 3;
    case Case = 4;
}

class Label implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        /** @var string|null */
        public ?string $name=null,
        /** @var string|null */
        public ?string $color=null,
        /** @var LabelType|null */
        public ?LabelType $type=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['color'])) $this->color = $o['color'];
        if (isset($o['type'])) $this->type = JsonConverters::from('LabelType', $o['type']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->color)) $o['color'] = $this->color;
        if (isset($this->type)) $o['type'] = JsonConverters::to('LabelType', $this->type);
        return empty($o) ? new class(){} : $o;
    }
}

class Comment implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        /** @var int|null */
        public ?int $turbineId=null,
        /** @var string|null */
        public ?string $turbineName=null,
        /** @var DateTime */
        public DateTime $timeStamp=new DateTime(),
        /** @var string|null */
        public ?string $text=null,
        /** @var string|null */
        public ?string $createdBy=null,
        /** @var float|null */
        public ?float $createdById=null,
        /** @var DateTime */
        public DateTime $lastModified=new DateTime(),
        /** @var CommentType|null */
        public ?CommentType $type=null,
        /** @var bool|null */
        public ?bool $external=null,
        /** @var bool|null */
        public ?bool $sticky=null,
        /** @var int|null */
        public ?int $allocationId=null,
        /** @var int|null */
        public ?int $alarmLogId=null,
        /** @var int|null */
        public ?int $alarmId=null,
        /** @var int|null */
        public ?int $commandId=null,
        /** @var string|null */
        public ?string $relatedInfo=null,
        /** @var bool|null */
        public ?bool $cleared=null,
        /** @var array<Label>|null */
        public ?array $labels=null,
        /** @var string|null */
        public ?string $objectId=null,
        /** @var DateTime|null */
        public ?DateTime $relatedStart=null,
        /** @var DateTime|null */
        public ?DateTime $relatedEnd=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['turbineId'])) $this->turbineId = $o['turbineId'];
        if (isset($o['turbineName'])) $this->turbineName = $o['turbineName'];
        if (isset($o['timeStamp'])) $this->timeStamp = JsonConverters::from('DateTime', $o['timeStamp']);
        if (isset($o['text'])) $this->text = $o['text'];
        if (isset($o['createdBy'])) $this->createdBy = $o['createdBy'];
        if (isset($o['createdById'])) $this->createdById = $o['createdById'];
        if (isset($o['lastModified'])) $this->lastModified = JsonConverters::from('DateTime', $o['lastModified']);
        if (isset($o['type'])) $this->type = JsonConverters::from('CommentType', $o['type']);
        if (isset($o['external'])) $this->external = $o['external'];
        if (isset($o['sticky'])) $this->sticky = $o['sticky'];
        if (isset($o['allocationId'])) $this->allocationId = $o['allocationId'];
        if (isset($o['alarmLogId'])) $this->alarmLogId = $o['alarmLogId'];
        if (isset($o['alarmId'])) $this->alarmId = $o['alarmId'];
        if (isset($o['commandId'])) $this->commandId = $o['commandId'];
        if (isset($o['relatedInfo'])) $this->relatedInfo = $o['relatedInfo'];
        if (isset($o['cleared'])) $this->cleared = $o['cleared'];
        if (isset($o['labels'])) $this->labels = JsonConverters::fromArray('Label', $o['labels']);
        if (isset($o['objectId'])) $this->objectId = $o['objectId'];
        if (isset($o['relatedStart'])) $this->relatedStart = JsonConverters::from('DateTime', $o['relatedStart']);
        if (isset($o['relatedEnd'])) $this->relatedEnd = JsonConverters::from('DateTime', $o['relatedEnd']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->turbineId)) $o['turbineId'] = $this->turbineId;
        if (isset($this->turbineName)) $o['turbineName'] = $this->turbineName;
        if (isset($this->timeStamp)) $o['timeStamp'] = JsonConverters::to('DateTime', $this->timeStamp);
        if (isset($this->text)) $o['text'] = $this->text;
        if (isset($this->createdBy)) $o['createdBy'] = $this->createdBy;
        if (isset($this->createdById)) $o['createdById'] = $this->createdById;
        if (isset($this->lastModified)) $o['lastModified'] = JsonConverters::to('DateTime', $this->lastModified);
        if (isset($this->type)) $o['type'] = JsonConverters::to('CommentType', $this->type);
        if (isset($this->external)) $o['external'] = $this->external;
        if (isset($this->sticky)) $o['sticky'] = $this->sticky;
        if (isset($this->allocationId)) $o['allocationId'] = $this->allocationId;
        if (isset($this->alarmLogId)) $o['alarmLogId'] = $this->alarmLogId;
        if (isset($this->alarmId)) $o['alarmId'] = $this->alarmId;
        if (isset($this->commandId)) $o['commandId'] = $this->commandId;
        if (isset($this->relatedInfo)) $o['relatedInfo'] = $this->relatedInfo;
        if (isset($this->cleared)) $o['cleared'] = $this->cleared;
        if (isset($this->labels)) $o['labels'] = JsonConverters::toArray('Label', $this->labels);
        if (isset($this->objectId)) $o['objectId'] = $this->objectId;
        if (isset($this->relatedStart)) $o['relatedStart'] = JsonConverters::to('DateTime', $this->relatedStart);
        if (isset($this->relatedEnd)) $o['relatedEnd'] = JsonConverters::to('DateTime', $this->relatedEnd);
        return empty($o) ? new class(){} : $o;
    }
}

class Allocation implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        /** @var int */
        public int $turbineId=0,
        /** @var string|null */
        public ?string $objectId=null,
        /** @var string|null */
        public ?string $turbineName=null,
        /** @var string|null */
        public ?string $turbineTitle=null,
        /** @var int */
        public int $sourceId=0,
        /** @var string|null */
        public ?string $sourceName=null,
        /** @var string|null */
        public ?string $rootCause=null,
        /** @var TriggerAlarm|null */
        public ?TriggerAlarm $triggeredByAlarm=null,
        /** @var AllocationCategoryWithType|null */
        public ?AllocationCategoryWithType $category=null,
        /** @var array<AllocationCategoryWithType>|null */
        public ?array $categories=null,
        /** @var DateTime */
        public DateTime $start=new DateTime(),
        /** @var DateTime */
        public DateTime $end=new DateTime(),
        /** @var DateTime */
        public DateTime $start_Local=new DateTime(),
        /** @var DateTime */
        public DateTime $end_Local=new DateTime(),
        /** @var DateInterval|null */
        public ?DateInterval $duration=null,
        /** @var DateTime */
        public DateTime $lastModified=new DateTime(),
        /** @var bool|null */
        public ?bool $isUnclassified=null,
        /** @var bool|null */
        public ?bool $manualOverrideLoss=null,
        /** @var DateTime|null */
        public ?DateTime $responseTime=null,
        /** @var float|null */
        public ?float $lostProduction=null,
        /** @var float|null */
        public ?float $lostProdutionFiltered=null,
        /** @var float|null */
        public ?float $lostMoney=null,
        /** @var float|null */
        public ?float $lostMoneyFiltered=null,
        /** @var array<AllocationPropertyValue>|null */
        public ?array $properties=null,
        /** @var bool|null */
        public ?bool $finished=null,
        /** @var bool|null */
        public ?bool $manual=null,
        /** @var bool|null */
        public ?bool $overridden=null,
        /** @var bool|null */
        public ?bool $reallocated=null,
        /** @var bool|null */
        public ?bool $pending=null,
        /** @var string|null */
        public ?string $changeLog=null,
        /** @var Comment|null */
        public ?Comment $lastComment=null,
        /** @var string|null */
        public ?string $exported=null,
        /** @var array<Label>|null */
        public ?array $labels=null,
        /** @var bool|null */
        public ?bool $suspect=null,
        /** @var bool|null */
        public ?bool $uncertain=null,
        /** @var int|null */
        public ?int $eventId=null,
        /** @var bool|null */
        public ?bool $hasEvent=null,
        /** @var bool|null */
        public ?bool $holdCategory=null,
        /** @var bool|null */
        public ?bool $approved=null,
        /** @var string|null */
        public ?string $sfId=null,
        /** @var string|null */
        public ?string $firstAlarmSfId=null,
        /** @var int|null */
        public ?int $rootCauseAlarmId=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['turbineId'])) $this->turbineId = $o['turbineId'];
        if (isset($o['objectId'])) $this->objectId = $o['objectId'];
        if (isset($o['turbineName'])) $this->turbineName = $o['turbineName'];
        if (isset($o['turbineTitle'])) $this->turbineTitle = $o['turbineTitle'];
        if (isset($o['sourceId'])) $this->sourceId = $o['sourceId'];
        if (isset($o['sourceName'])) $this->sourceName = $o['sourceName'];
        if (isset($o['rootCause'])) $this->rootCause = $o['rootCause'];
        if (isset($o['triggeredByAlarm'])) $this->triggeredByAlarm = JsonConverters::from('TriggerAlarm', $o['triggeredByAlarm']);
        if (isset($o['category'])) $this->category = JsonConverters::from('AllocationCategoryWithType', $o['category']);
        if (isset($o['categories'])) $this->categories = JsonConverters::fromArray('AllocationCategoryWithType', $o['categories']);
        if (isset($o['start'])) $this->start = JsonConverters::from('DateTime', $o['start']);
        if (isset($o['end'])) $this->end = JsonConverters::from('DateTime', $o['end']);
        if (isset($o['start_Local'])) $this->start_Local = JsonConverters::from('DateTime', $o['start_Local']);
        if (isset($o['end_Local'])) $this->end_Local = JsonConverters::from('DateTime', $o['end_Local']);
        if (isset($o['duration'])) $this->duration = JsonConverters::from('DateInterval', $o['duration']);
        if (isset($o['lastModified'])) $this->lastModified = JsonConverters::from('DateTime', $o['lastModified']);
        if (isset($o['isUnclassified'])) $this->isUnclassified = $o['isUnclassified'];
        if (isset($o['manualOverrideLoss'])) $this->manualOverrideLoss = $o['manualOverrideLoss'];
        if (isset($o['responseTime'])) $this->responseTime = JsonConverters::from('DateTime', $o['responseTime']);
        if (isset($o['lostProduction'])) $this->lostProduction = $o['lostProduction'];
        if (isset($o['lostProdutionFiltered'])) $this->lostProdutionFiltered = $o['lostProdutionFiltered'];
        if (isset($o['lostMoney'])) $this->lostMoney = $o['lostMoney'];
        if (isset($o['lostMoneyFiltered'])) $this->lostMoneyFiltered = $o['lostMoneyFiltered'];
        if (isset($o['properties'])) $this->properties = JsonConverters::fromArray('AllocationPropertyValue', $o['properties']);
        if (isset($o['finished'])) $this->finished = $o['finished'];
        if (isset($o['manual'])) $this->manual = $o['manual'];
        if (isset($o['overridden'])) $this->overridden = $o['overridden'];
        if (isset($o['reallocated'])) $this->reallocated = $o['reallocated'];
        if (isset($o['pending'])) $this->pending = $o['pending'];
        if (isset($o['changeLog'])) $this->changeLog = $o['changeLog'];
        if (isset($o['lastComment'])) $this->lastComment = JsonConverters::from('Comment', $o['lastComment']);
        if (isset($o['exported'])) $this->exported = $o['exported'];
        if (isset($o['labels'])) $this->labels = JsonConverters::fromArray('Label', $o['labels']);
        if (isset($o['suspect'])) $this->suspect = $o['suspect'];
        if (isset($o['uncertain'])) $this->uncertain = $o['uncertain'];
        if (isset($o['eventId'])) $this->eventId = $o['eventId'];
        if (isset($o['hasEvent'])) $this->hasEvent = $o['hasEvent'];
        if (isset($o['holdCategory'])) $this->holdCategory = $o['holdCategory'];
        if (isset($o['approved'])) $this->approved = $o['approved'];
        if (isset($o['sfId'])) $this->sfId = $o['sfId'];
        if (isset($o['firstAlarmSfId'])) $this->firstAlarmSfId = $o['firstAlarmSfId'];
        if (isset($o['rootCauseAlarmId'])) $this->rootCauseAlarmId = $o['rootCauseAlarmId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->turbineId)) $o['turbineId'] = $this->turbineId;
        if (isset($this->objectId)) $o['objectId'] = $this->objectId;
        if (isset($this->turbineName)) $o['turbineName'] = $this->turbineName;
        if (isset($this->turbineTitle)) $o['turbineTitle'] = $this->turbineTitle;
        if (isset($this->sourceId)) $o['sourceId'] = $this->sourceId;
        if (isset($this->sourceName)) $o['sourceName'] = $this->sourceName;
        if (isset($this->rootCause)) $o['rootCause'] = $this->rootCause;
        if (isset($this->triggeredByAlarm)) $o['triggeredByAlarm'] = JsonConverters::to('TriggerAlarm', $this->triggeredByAlarm);
        if (isset($this->category)) $o['category'] = JsonConverters::to('AllocationCategoryWithType', $this->category);
        if (isset($this->categories)) $o['categories'] = JsonConverters::toArray('AllocationCategoryWithType', $this->categories);
        if (isset($this->start)) $o['start'] = JsonConverters::to('DateTime', $this->start);
        if (isset($this->end)) $o['end'] = JsonConverters::to('DateTime', $this->end);
        if (isset($this->start_Local)) $o['start_Local'] = JsonConverters::to('DateTime', $this->start_Local);
        if (isset($this->end_Local)) $o['end_Local'] = JsonConverters::to('DateTime', $this->end_Local);
        if (isset($this->duration)) $o['duration'] = JsonConverters::to('DateInterval', $this->duration);
        if (isset($this->lastModified)) $o['lastModified'] = JsonConverters::to('DateTime', $this->lastModified);
        if (isset($this->isUnclassified)) $o['isUnclassified'] = $this->isUnclassified;
        if (isset($this->manualOverrideLoss)) $o['manualOverrideLoss'] = $this->manualOverrideLoss;
        if (isset($this->responseTime)) $o['responseTime'] = JsonConverters::to('DateTime', $this->responseTime);
        if (isset($this->lostProduction)) $o['lostProduction'] = $this->lostProduction;
        if (isset($this->lostProdutionFiltered)) $o['lostProdutionFiltered'] = $this->lostProdutionFiltered;
        if (isset($this->lostMoney)) $o['lostMoney'] = $this->lostMoney;
        if (isset($this->lostMoneyFiltered)) $o['lostMoneyFiltered'] = $this->lostMoneyFiltered;
        if (isset($this->properties)) $o['properties'] = JsonConverters::toArray('AllocationPropertyValue', $this->properties);
        if (isset($this->finished)) $o['finished'] = $this->finished;
        if (isset($this->manual)) $o['manual'] = $this->manual;
        if (isset($this->overridden)) $o['overridden'] = $this->overridden;
        if (isset($this->reallocated)) $o['reallocated'] = $this->reallocated;
        if (isset($this->pending)) $o['pending'] = $this->pending;
        if (isset($this->changeLog)) $o['changeLog'] = $this->changeLog;
        if (isset($this->lastComment)) $o['lastComment'] = JsonConverters::to('Comment', $this->lastComment);
        if (isset($this->exported)) $o['exported'] = $this->exported;
        if (isset($this->labels)) $o['labels'] = JsonConverters::toArray('Label', $this->labels);
        if (isset($this->suspect)) $o['suspect'] = $this->suspect;
        if (isset($this->uncertain)) $o['uncertain'] = $this->uncertain;
        if (isset($this->eventId)) $o['eventId'] = $this->eventId;
        if (isset($this->hasEvent)) $o['hasEvent'] = $this->hasEvent;
        if (isset($this->holdCategory)) $o['holdCategory'] = $this->holdCategory;
        if (isset($this->approved)) $o['approved'] = $this->approved;
        if (isset($this->sfId)) $o['sfId'] = $this->sfId;
        if (isset($this->firstAlarmSfId)) $o['firstAlarmSfId'] = $this->firstAlarmSfId;
        if (isset($this->rootCauseAlarmId)) $o['rootCauseAlarmId'] = $this->rootCauseAlarmId;
        return empty($o) ? new class(){} : $o;
    }
}

class GetAllocation implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetAllocation DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /allocations/{Id} HTTP/1.1 
Host: monitoring.ox2.com 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	id: 0,
	turbineId: 0,
	objectId: String,
	turbineName: String,
	turbineTitle: String,
	sourceId: 0,
	sourceName: String,
	rootCause: String,
	triggeredByAlarm: 
	{
		alarm: 
		{
			id: 0,
			code: 0,
			name: String,
			brakePrg: 0,
			canTriggerAllocation: False,
			description: String,
			remarks: String,
			resetPrg: ,
			isOkAlarm: False,
			meta: 
			{
				String: String
			},
			alarmType: 0,
			type: Warning
		},
		start: 0001-01-01,
		end: 0001-01-01,
		logId: 0,
		sfId: String
	},
	category: 
	{
		allocationType: 
		{
			id: 0,
			name: String,
			acronym: String,
			version: String,
			description: String,
			sortOrder: 0,
			linkedTypeId: 0,
			subType: False,
			groupName: String,
			defaultVisible: False,
			domainId: 0,
			disabled: False,
			matrix: String,
			certified: False,
			allocationTypeClassId: 0,
			variantOfAbstractTypeId: 0
		},
		id: 0,
		name: String,
		acronym: String,
		color: String,
		uncategorized: False,
		available: False,
		typeId: 0,
		group: String,
		sortIndex: 0,
		priority: 0,
		enabled: False,
		performance: 0,
		excluded: 0,
		parentCategoryId: 0,
		parentCategoryName: String,
		code: String,
		variantAlias: String,
		attributes: 
		{
			String: String
		}
	},
	categories: 
	[
		{
			allocationType: 
			{
				id: 0,
				name: String,
				acronym: String,
				version: String,
				description: String,
				sortOrder: 0,
				linkedTypeId: 0,
				subType: False,
				groupName: String,
				defaultVisible: False,
				domainId: 0,
				disabled: False,
				matrix: String,
				certified: False,
				allocationTypeClassId: 0,
				variantOfAbstractTypeId: 0
			},
			id: 0,
			name: String,
			acronym: String,
			color: String,
			uncategorized: False,
			available: False,
			typeId: 0,
			group: String,
			sortIndex: 0,
			priority: 0,
			enabled: False,
			performance: 0,
			excluded: 0,
			parentCategoryId: 0,
			parentCategoryName: String,
			code: String,
			variantAlias: String,
			attributes: 
			{
				String: String
			}
		}
	],
	start: 0001-01-01,
	end: 0001-01-01,
	start_Local: 0001-01-01T00:00:00.0000000+00:00,
	end_Local: 0001-01-01T00:00:00.0000000+00:00,
	duration: P739710DT15H35M59.4340591S,
	lastModified: 0001-01-01,
	isUnclassified: False,
	manualOverrideLoss: False,
	responseTime: 0001-01-01,
	lostProduction: 0,
	lostProdutionFiltered: 0,
	lostMoney: 0,
	lostMoneyFiltered: 0,
	properties: 
	[
		{
			
		}
	],
	finished: False,
	manual: False,
	overridden: False,
	reallocated: False,
	pending: False,
	changeLog: String,
	lastComment: 
	{
		id: 0,
		turbineId: 0,
		turbineName: String,
		timeStamp: 0001-01-01,
		text: String,
		createdBy: String,
		createdById: 0,
		lastModified: 0001-01-01,
		type: Turbine,
		external: False,
		sticky: False,
		allocationId: 0,
		alarmLogId: 0,
		alarmId: 0,
		commandId: 0,
		relatedInfo: String,
		cleared: False,
		labels: 
		[
			{
				id: 0,
				name: String,
				color: String,
				type: 0
			}
		],
		objectId: String,
		relatedStart: 0001-01-01,
		relatedEnd: 0001-01-01
	},
	exported: String,
	labels: 
	[
		{
			id: 0,
			name: String,
			color: String,
			type: 0
		}
	],
	suspect: False,
	uncertain: False,
	eventId: 0,
	hasEvent: False,
	holdCategory: False,
	approved: False,
	sfId: String,
	firstAlarmSfId: String,
	rootCauseAlarmId: 0
}