Trendsic Platform Service

<back to all web services

ScheduleReorderRequest

Requires Authentication
The following routes are available for this service:
POST/v1/schedule/reorder
<?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 WorkerScheduleItem implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $WorkerScheduleItemID=0,
        /** @var int */
        public int $JobID=0,
        /** @var int|null */
        public ?int $ProjectID=null,
        /** @var int */
        public int $ContactID=0,
        /** @var DateTime|null */
        public ?DateTime $ScheduledDate=null,
        /** @var int */
        public int $SortOrder=0,
        /** @var int|null */
        public ?int $SourceCrewID=null,
        /** @var string|null */
        public ?string $Status=null,
        /** @var DateTime|null */
        public ?DateTime $StartedAt=null,
        /** @var DateTime|null */
        public ?DateTime $CompletedAt=null,
        /** @var string|null */
        public ?string $WorkerNotes=null,
        /** @var string|null */
        public ?string $JobName=null,
        /** @var string|null */
        public ?string $ProjectName=null,
        /** @var string|null */
        public ?string $FirstName=null,
        /** @var string|null */
        public ?string $LastName=null,
        /** @var string|null */
        public ?string $WorkerName=null,
        /** @var string|null */
        public ?string $SourceCrewName=null,
        /** @var int|null */
        public ?int $ProjectLocationID=null,
        /** @var string|null */
        public ?string $ProjectLocationName=null,
        /** @var string|null */
        public ?string $LocationZip=null,
        /** @var string|null */
        public ?string $LocationCity=null,
        /** @var float|null */
        public ?float $LocationLatitude=null,
        /** @var float|null */
        public ?float $LocationLongitude=null,
        /** @var string|null */
        public ?string $JobStatusName=null,
        /** @var string */
        public string $BranchId='',
        /** @var string|null */
        public ?string $BranchName=null,
        /** @var string|null */
        public ?string $WorkerHomeBranchId=null,
        /** @var string|null */
        public ?string $WorkerHomeBranchName=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['WorkerScheduleItemID'])) $this->WorkerScheduleItemID = $o['WorkerScheduleItemID'];
        if (isset($o['JobID'])) $this->JobID = $o['JobID'];
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        if (isset($o['ContactID'])) $this->ContactID = $o['ContactID'];
        if (isset($o['ScheduledDate'])) $this->ScheduledDate = JsonConverters::from('DateTime', $o['ScheduledDate']);
        if (isset($o['SortOrder'])) $this->SortOrder = $o['SortOrder'];
        if (isset($o['SourceCrewID'])) $this->SourceCrewID = $o['SourceCrewID'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['StartedAt'])) $this->StartedAt = JsonConverters::from('DateTime', $o['StartedAt']);
        if (isset($o['CompletedAt'])) $this->CompletedAt = JsonConverters::from('DateTime', $o['CompletedAt']);
        if (isset($o['WorkerNotes'])) $this->WorkerNotes = $o['WorkerNotes'];
        if (isset($o['JobName'])) $this->JobName = $o['JobName'];
        if (isset($o['ProjectName'])) $this->ProjectName = $o['ProjectName'];
        if (isset($o['FirstName'])) $this->FirstName = $o['FirstName'];
        if (isset($o['LastName'])) $this->LastName = $o['LastName'];
        if (isset($o['WorkerName'])) $this->WorkerName = $o['WorkerName'];
        if (isset($o['SourceCrewName'])) $this->SourceCrewName = $o['SourceCrewName'];
        if (isset($o['ProjectLocationID'])) $this->ProjectLocationID = $o['ProjectLocationID'];
        if (isset($o['ProjectLocationName'])) $this->ProjectLocationName = $o['ProjectLocationName'];
        if (isset($o['LocationZip'])) $this->LocationZip = $o['LocationZip'];
        if (isset($o['LocationCity'])) $this->LocationCity = $o['LocationCity'];
        if (isset($o['LocationLatitude'])) $this->LocationLatitude = $o['LocationLatitude'];
        if (isset($o['LocationLongitude'])) $this->LocationLongitude = $o['LocationLongitude'];
        if (isset($o['JobStatusName'])) $this->JobStatusName = $o['JobStatusName'];
        if (isset($o['BranchId'])) $this->BranchId = $o['BranchId'];
        if (isset($o['BranchName'])) $this->BranchName = $o['BranchName'];
        if (isset($o['WorkerHomeBranchId'])) $this->WorkerHomeBranchId = $o['WorkerHomeBranchId'];
        if (isset($o['WorkerHomeBranchName'])) $this->WorkerHomeBranchName = $o['WorkerHomeBranchName'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->WorkerScheduleItemID)) $o['WorkerScheduleItemID'] = $this->WorkerScheduleItemID;
        if (isset($this->JobID)) $o['JobID'] = $this->JobID;
        if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        if (isset($this->ContactID)) $o['ContactID'] = $this->ContactID;
        if (isset($this->ScheduledDate)) $o['ScheduledDate'] = JsonConverters::to('DateTime', $this->ScheduledDate);
        if (isset($this->SortOrder)) $o['SortOrder'] = $this->SortOrder;
        if (isset($this->SourceCrewID)) $o['SourceCrewID'] = $this->SourceCrewID;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->StartedAt)) $o['StartedAt'] = JsonConverters::to('DateTime', $this->StartedAt);
        if (isset($this->CompletedAt)) $o['CompletedAt'] = JsonConverters::to('DateTime', $this->CompletedAt);
        if (isset($this->WorkerNotes)) $o['WorkerNotes'] = $this->WorkerNotes;
        if (isset($this->JobName)) $o['JobName'] = $this->JobName;
        if (isset($this->ProjectName)) $o['ProjectName'] = $this->ProjectName;
        if (isset($this->FirstName)) $o['FirstName'] = $this->FirstName;
        if (isset($this->LastName)) $o['LastName'] = $this->LastName;
        if (isset($this->WorkerName)) $o['WorkerName'] = $this->WorkerName;
        if (isset($this->SourceCrewName)) $o['SourceCrewName'] = $this->SourceCrewName;
        if (isset($this->ProjectLocationID)) $o['ProjectLocationID'] = $this->ProjectLocationID;
        if (isset($this->ProjectLocationName)) $o['ProjectLocationName'] = $this->ProjectLocationName;
        if (isset($this->LocationZip)) $o['LocationZip'] = $this->LocationZip;
        if (isset($this->LocationCity)) $o['LocationCity'] = $this->LocationCity;
        if (isset($this->LocationLatitude)) $o['LocationLatitude'] = $this->LocationLatitude;
        if (isset($this->LocationLongitude)) $o['LocationLongitude'] = $this->LocationLongitude;
        if (isset($this->JobStatusName)) $o['JobStatusName'] = $this->JobStatusName;
        if (isset($this->BranchId)) $o['BranchId'] = $this->BranchId;
        if (isset($this->BranchName)) $o['BranchName'] = $this->BranchName;
        if (isset($this->WorkerHomeBranchId)) $o['WorkerHomeBranchId'] = $this->WorkerHomeBranchId;
        if (isset($this->WorkerHomeBranchName)) $o['WorkerHomeBranchName'] = $this->WorkerHomeBranchName;
        return empty($o) ? new class(){} : $o;
    }
}

class SchedulableJob implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $JobID=0,
        /** @var string|null */
        public ?string $JobName=null,
        /** @var int */
        public int $ProjectID=0,
        /** @var string|null */
        public ?string $ProjectName=null,
        /** @var int|null */
        public ?int $StatusID=null,
        /** @var string|null */
        public ?string $StatusName=null,
        /** @var int|null */
        public ?int $ProjectLocationID=null,
        /** @var string|null */
        public ?string $ProjectLocationName=null,
        /** @var string|null */
        public ?string $LocationZip=null,
        /** @var string|null */
        public ?string $LocationCity=null,
        /** @var float|null */
        public ?float $LocationLatitude=null,
        /** @var float|null */
        public ?float $LocationLongitude=null,
        /** @var DateTime|null */
        public ?DateTime $ExpectedStartDate=null,
        /** @var DateTime|null */
        public ?DateTime $ExpectedCompletionDate=null,
        /** @var bool|null */
        public ?bool $IsRecurring=null,
        /** @var array<string>|null */
        public ?array $OccurrenceDates=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['JobID'])) $this->JobID = $o['JobID'];
        if (isset($o['JobName'])) $this->JobName = $o['JobName'];
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        if (isset($o['ProjectName'])) $this->ProjectName = $o['ProjectName'];
        if (isset($o['StatusID'])) $this->StatusID = $o['StatusID'];
        if (isset($o['StatusName'])) $this->StatusName = $o['StatusName'];
        if (isset($o['ProjectLocationID'])) $this->ProjectLocationID = $o['ProjectLocationID'];
        if (isset($o['ProjectLocationName'])) $this->ProjectLocationName = $o['ProjectLocationName'];
        if (isset($o['LocationZip'])) $this->LocationZip = $o['LocationZip'];
        if (isset($o['LocationCity'])) $this->LocationCity = $o['LocationCity'];
        if (isset($o['LocationLatitude'])) $this->LocationLatitude = $o['LocationLatitude'];
        if (isset($o['LocationLongitude'])) $this->LocationLongitude = $o['LocationLongitude'];
        if (isset($o['ExpectedStartDate'])) $this->ExpectedStartDate = JsonConverters::from('DateTime', $o['ExpectedStartDate']);
        if (isset($o['ExpectedCompletionDate'])) $this->ExpectedCompletionDate = JsonConverters::from('DateTime', $o['ExpectedCompletionDate']);
        if (isset($o['IsRecurring'])) $this->IsRecurring = $o['IsRecurring'];
        if (isset($o['OccurrenceDates'])) $this->OccurrenceDates = JsonConverters::fromArray('string', $o['OccurrenceDates']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->JobID)) $o['JobID'] = $this->JobID;
        if (isset($this->JobName)) $o['JobName'] = $this->JobName;
        if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        if (isset($this->ProjectName)) $o['ProjectName'] = $this->ProjectName;
        if (isset($this->StatusID)) $o['StatusID'] = $this->StatusID;
        if (isset($this->StatusName)) $o['StatusName'] = $this->StatusName;
        if (isset($this->ProjectLocationID)) $o['ProjectLocationID'] = $this->ProjectLocationID;
        if (isset($this->ProjectLocationName)) $o['ProjectLocationName'] = $this->ProjectLocationName;
        if (isset($this->LocationZip)) $o['LocationZip'] = $this->LocationZip;
        if (isset($this->LocationCity)) $o['LocationCity'] = $this->LocationCity;
        if (isset($this->LocationLatitude)) $o['LocationLatitude'] = $this->LocationLatitude;
        if (isset($this->LocationLongitude)) $o['LocationLongitude'] = $this->LocationLongitude;
        if (isset($this->ExpectedStartDate)) $o['ExpectedStartDate'] = JsonConverters::to('DateTime', $this->ExpectedStartDate);
        if (isset($this->ExpectedCompletionDate)) $o['ExpectedCompletionDate'] = JsonConverters::to('DateTime', $this->ExpectedCompletionDate);
        if (isset($this->IsRecurring)) $o['IsRecurring'] = $this->IsRecurring;
        if (isset($this->OccurrenceDates)) $o['OccurrenceDates'] = JsonConverters::toArray('string', $this->OccurrenceDates);
        return empty($o) ? new class(){} : $o;
    }
}

class ScheduleWorker implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ContactId=0,
        /** @var string|null */
        public ?string $FirstName=null,
        /** @var string|null */
        public ?string $LastName=null,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Initials=null,
        /** @var float|null */
        public ?float $Rate=null,
        /** @var string|null */
        public ?string $ImageUrl=null,
        /** @var string|null */
        public ?string $BranchId=null,
        /** @var string|null */
        public ?string $BranchName=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
        if (isset($o['FirstName'])) $this->FirstName = $o['FirstName'];
        if (isset($o['LastName'])) $this->LastName = $o['LastName'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Initials'])) $this->Initials = $o['Initials'];
        if (isset($o['Rate'])) $this->Rate = $o['Rate'];
        if (isset($o['ImageUrl'])) $this->ImageUrl = $o['ImageUrl'];
        if (isset($o['BranchId'])) $this->BranchId = $o['BranchId'];
        if (isset($o['BranchName'])) $this->BranchName = $o['BranchName'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
        if (isset($this->FirstName)) $o['FirstName'] = $this->FirstName;
        if (isset($this->LastName)) $o['LastName'] = $this->LastName;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Initials)) $o['Initials'] = $this->Initials;
        if (isset($this->Rate)) $o['Rate'] = $this->Rate;
        if (isset($this->ImageUrl)) $o['ImageUrl'] = $this->ImageUrl;
        if (isset($this->BranchId)) $o['BranchId'] = $this->BranchId;
        if (isset($this->BranchName)) $o['BranchName'] = $this->BranchName;
        return empty($o) ? new class(){} : $o;
    }
}

class Crew implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $CrewID=0,
        /** @var string|null */
        public ?string $CrewName=null,
        /** @var string|null */
        public ?string $CrewNumber=null,
        /** @var int */
        public int $CrewManagerContactID=0,
        /** @var string|null */
        public ?string $CrewManagerContactName=null,
        /** @var string|null */
        public ?string $CrewColor=null,
        /** @var DateTime */
        public DateTime $RecordCreatedDate=new DateTime(),
        /** @var bool|null */
        public ?bool $Active=null,
        /** @var string */
        public string $CreatedByUID='',
        /** @var int */
        public int $ProjectID=0,
        /** @var int */
        public int $CrewMemberCount=0,
        /** @var int */
        public int $ProjectCrewID=0,
        /** @var string|null */
        public ?string $ProjectName=null,
        /** @var string */
        public string $BranchId='',
        /** @var string|null */
        public ?string $BranchName=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CrewID'])) $this->CrewID = $o['CrewID'];
        if (isset($o['CrewName'])) $this->CrewName = $o['CrewName'];
        if (isset($o['CrewNumber'])) $this->CrewNumber = $o['CrewNumber'];
        if (isset($o['CrewManagerContactID'])) $this->CrewManagerContactID = $o['CrewManagerContactID'];
        if (isset($o['CrewManagerContactName'])) $this->CrewManagerContactName = $o['CrewManagerContactName'];
        if (isset($o['CrewColor'])) $this->CrewColor = $o['CrewColor'];
        if (isset($o['RecordCreatedDate'])) $this->RecordCreatedDate = JsonConverters::from('DateTime', $o['RecordCreatedDate']);
        if (isset($o['Active'])) $this->Active = $o['Active'];
        if (isset($o['CreatedByUID'])) $this->CreatedByUID = $o['CreatedByUID'];
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        if (isset($o['CrewMemberCount'])) $this->CrewMemberCount = $o['CrewMemberCount'];
        if (isset($o['ProjectCrewID'])) $this->ProjectCrewID = $o['ProjectCrewID'];
        if (isset($o['ProjectName'])) $this->ProjectName = $o['ProjectName'];
        if (isset($o['BranchId'])) $this->BranchId = $o['BranchId'];
        if (isset($o['BranchName'])) $this->BranchName = $o['BranchName'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CrewID)) $o['CrewID'] = $this->CrewID;
        if (isset($this->CrewName)) $o['CrewName'] = $this->CrewName;
        if (isset($this->CrewNumber)) $o['CrewNumber'] = $this->CrewNumber;
        if (isset($this->CrewManagerContactID)) $o['CrewManagerContactID'] = $this->CrewManagerContactID;
        if (isset($this->CrewManagerContactName)) $o['CrewManagerContactName'] = $this->CrewManagerContactName;
        if (isset($this->CrewColor)) $o['CrewColor'] = $this->CrewColor;
        if (isset($this->RecordCreatedDate)) $o['RecordCreatedDate'] = JsonConverters::to('DateTime', $this->RecordCreatedDate);
        if (isset($this->Active)) $o['Active'] = $this->Active;
        if (isset($this->CreatedByUID)) $o['CreatedByUID'] = $this->CreatedByUID;
        if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        if (isset($this->CrewMemberCount)) $o['CrewMemberCount'] = $this->CrewMemberCount;
        if (isset($this->ProjectCrewID)) $o['ProjectCrewID'] = $this->ProjectCrewID;
        if (isset($this->ProjectName)) $o['ProjectName'] = $this->ProjectName;
        if (isset($this->BranchId)) $o['BranchId'] = $this->BranchId;
        if (isset($this->BranchName)) $o['BranchName'] = $this->BranchName;
        return empty($o) ? new class(){} : $o;
    }
}

class ScheduleLastAssignment implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $JobID=0,
        /** @var array<int>|null */
        public ?array $ContactIds=null,
        /** @var int|null */
        public ?int $SourceCrewID=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['JobID'])) $this->JobID = $o['JobID'];
        if (isset($o['ContactIds'])) $this->ContactIds = JsonConverters::fromArray('int', $o['ContactIds']);
        if (isset($o['SourceCrewID'])) $this->SourceCrewID = $o['SourceCrewID'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->JobID)) $o['JobID'] = $this->JobID;
        if (isset($this->ContactIds)) $o['ContactIds'] = JsonConverters::toArray('int', $this->ContactIds);
        if (isset($this->SourceCrewID)) $o['SourceCrewID'] = $this->SourceCrewID;
        return empty($o) ? new class(){} : $o;
    }
}

class ScheduleAutoFillResult implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $JobsFilled=0,
        /** @var int */
        public int $JobsSkipped=0,
        /** @var int */
        public int $VisitsScheduled=0
    ) {
    }

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

class WorkerScheduleResponse implements JsonSerializable
{
    public function __construct(
        /** @var array<WorkerScheduleItem>|null */
        public ?array $Items=null,
        /** @var array<SchedulableJob>|null */
        public ?array $SchedulableJobs=null,
        /** @var array<ScheduleWorker>|null */
        public ?array $Workers=null,
        /** @var array<Crew>|null */
        public ?array $Crews=null,
        /** @var array<ScheduleWorker>|null */
        public ?array $BudgetedCrew=null,
        /** @var ScheduleLastAssignment|null */
        public ?ScheduleLastAssignment $LastAssignment=null,
        /** @var ScheduleAutoFillResult|null */
        public ?ScheduleAutoFillResult $AutoFill=null,
        /** @var int|null */
        public ?int $DatesScheduled=null,
        /** @var int|null */
        public ?int $WorkersScheduled=null,
        /** @var int|null */
        public ?int $ItemsRemoved=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Items'])) $this->Items = JsonConverters::fromArray('WorkerScheduleItem', $o['Items']);
        if (isset($o['SchedulableJobs'])) $this->SchedulableJobs = JsonConverters::fromArray('SchedulableJob', $o['SchedulableJobs']);
        if (isset($o['Workers'])) $this->Workers = JsonConverters::fromArray('ScheduleWorker', $o['Workers']);
        if (isset($o['Crews'])) $this->Crews = JsonConverters::fromArray('Crew', $o['Crews']);
        if (isset($o['BudgetedCrew'])) $this->BudgetedCrew = JsonConverters::fromArray('ScheduleWorker', $o['BudgetedCrew']);
        if (isset($o['LastAssignment'])) $this->LastAssignment = JsonConverters::from('ScheduleLastAssignment', $o['LastAssignment']);
        if (isset($o['AutoFill'])) $this->AutoFill = JsonConverters::from('ScheduleAutoFillResult', $o['AutoFill']);
        if (isset($o['DatesScheduled'])) $this->DatesScheduled = $o['DatesScheduled'];
        if (isset($o['WorkersScheduled'])) $this->WorkersScheduled = $o['WorkersScheduled'];
        if (isset($o['ItemsRemoved'])) $this->ItemsRemoved = $o['ItemsRemoved'];
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Items)) $o['Items'] = JsonConverters::toArray('WorkerScheduleItem', $this->Items);
        if (isset($this->SchedulableJobs)) $o['SchedulableJobs'] = JsonConverters::toArray('SchedulableJob', $this->SchedulableJobs);
        if (isset($this->Workers)) $o['Workers'] = JsonConverters::toArray('ScheduleWorker', $this->Workers);
        if (isset($this->Crews)) $o['Crews'] = JsonConverters::toArray('Crew', $this->Crews);
        if (isset($this->BudgetedCrew)) $o['BudgetedCrew'] = JsonConverters::toArray('ScheduleWorker', $this->BudgetedCrew);
        if (isset($this->LastAssignment)) $o['LastAssignment'] = JsonConverters::to('ScheduleLastAssignment', $this->LastAssignment);
        if (isset($this->AutoFill)) $o['AutoFill'] = JsonConverters::to('ScheduleAutoFillResult', $this->AutoFill);
        if (isset($this->DatesScheduled)) $o['DatesScheduled'] = $this->DatesScheduled;
        if (isset($this->WorkersScheduled)) $o['WorkersScheduled'] = $this->WorkersScheduled;
        if (isset($this->ItemsRemoved)) $o['ItemsRemoved'] = $this->ItemsRemoved;
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

class ScheduleReorderRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ContactID=0,
        /** @var DateTime */
        public DateTime $ScheduledDate=new DateTime(),
        /** @var array<int>|null */
        public ?array $OrderedIds=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ContactID'])) $this->ContactID = $o['ContactID'];
        if (isset($o['ScheduledDate'])) $this->ScheduledDate = JsonConverters::from('DateTime', $o['ScheduledDate']);
        if (isset($o['OrderedIds'])) $this->OrderedIds = JsonConverters::fromArray('int', $o['OrderedIds']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ContactID)) $o['ContactID'] = $this->ContactID;
        if (isset($this->ScheduledDate)) $o['ScheduledDate'] = JsonConverters::to('DateTime', $this->ScheduledDate);
        if (isset($this->OrderedIds)) $o['OrderedIds'] = JsonConverters::toArray('int', $this->OrderedIds);
        return empty($o) ? new class(){} : $o;
    }
}

PHP ScheduleReorderRequest 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.

POST /v1/schedule/reorder HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	ContactID: 0,
	ScheduledDate: 0001-01-01,
	OrderedIds: 
	[
		0
	]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Items: 
	[
		{
			WorkerScheduleItemID: 0,
			JobID: 0,
			ProjectID: 0,
			ContactID: 0,
			ScheduledDate: 0001-01-01,
			SortOrder: 0,
			SourceCrewID: 0,
			Status: String,
			StartedAt: 0001-01-01,
			CompletedAt: 0001-01-01,
			WorkerNotes: String,
			JobName: String,
			ProjectName: String,
			FirstName: String,
			LastName: String,
			WorkerName: String,
			SourceCrewName: String,
			ProjectLocationID: 0,
			ProjectLocationName: String,
			LocationZip: String,
			LocationCity: String,
			LocationLatitude: 0,
			LocationLongitude: 0,
			JobStatusName: String,
			BranchId: 00000000000000000000000000000000,
			BranchName: String,
			WorkerHomeBranchId: 00000000000000000000000000000000,
			WorkerHomeBranchName: String
		}
	],
	SchedulableJobs: 
	[
		{
			JobID: 0,
			JobName: String,
			ProjectID: 0,
			ProjectName: String,
			StatusID: 0,
			StatusName: String,
			ProjectLocationID: 0,
			ProjectLocationName: String,
			LocationZip: String,
			LocationCity: String,
			LocationLatitude: 0,
			LocationLongitude: 0,
			ExpectedStartDate: 0001-01-01,
			ExpectedCompletionDate: 0001-01-01,
			IsRecurring: False,
			OccurrenceDates: 
			[
				String
			]
		}
	],
	Workers: 
	[
		{
			ContactId: 0,
			FirstName: String,
			LastName: String,
			Name: String,
			Initials: String,
			Rate: 0,
			ImageUrl: String,
			BranchId: 00000000000000000000000000000000,
			BranchName: String
		}
	],
	Crews: 
	[
		{
			CrewID: 0,
			CrewName: String,
			CrewNumber: String,
			CrewManagerContactID: 0,
			CrewManagerContactName: String,
			CrewColor: String,
			RecordCreatedDate: 0001-01-01,
			Active: False,
			CreatedByUID: 00000000000000000000000000000000,
			ProjectID: 0,
			CrewMemberCount: 0,
			ProjectCrewID: 0,
			ProjectName: String,
			BranchId: 00000000000000000000000000000000,
			BranchName: String
		}
	],
	BudgetedCrew: 
	[
		{
			ContactId: 0,
			FirstName: String,
			LastName: String,
			Name: String,
			Initials: String,
			Rate: 0,
			ImageUrl: String,
			BranchId: 00000000000000000000000000000000,
			BranchName: String
		}
	],
	LastAssignment: 
	{
		JobID: 0,
		ContactIds: 
		[
			0
		],
		SourceCrewID: 0
	},
	AutoFill: 
	{
		JobsFilled: 0,
		JobsSkipped: 0,
		VisitsScheduled: 0
	},
	DatesScheduled: 0,
	WorkersScheduled: 0,
	ItemsRemoved: 0,
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}