Trendsic Platform Service

<back to all web services

CourierRunReturnScanRequest

Requires Authentication
The following routes are available for this service:
POST,OPTIONS/v1/worker/dispatch/od/runs/{RunId}/returns
<?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 CourierVanView implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $State=null,
        /** @var DateTime|null */
        public ?DateTime $LeaveByUtc=null,
        /** @var string|null */
        public ?string $LeaveByText=null,
        /** @var int|null */
        public ?int $SlackMin=null,
        /** @var int */
        public int $InVan=0,
        /** @var int */
        public int $Committed=0,
        /** @var float|null */
        public ?float $Cap=null,
        /** @var string|null */
        public ?string $CapUnit=null,
        /** @var string|null */
        public ?string $VehicleUnit=null,
        /** @var string|null */
        public ?string $CriticalCode=null,
        /** @var int */
        public int $DriveMin=0,
        /** @var string|null */
        public ?string $FacilityName=null,
        /** @var string|null */
        public ?string $SendNote=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['State'])) $this->State = $o['State'];
        if (isset($o['LeaveByUtc'])) $this->LeaveByUtc = JsonConverters::from('DateTime', $o['LeaveByUtc']);
        if (isset($o['LeaveByText'])) $this->LeaveByText = $o['LeaveByText'];
        if (isset($o['SlackMin'])) $this->SlackMin = $o['SlackMin'];
        if (isset($o['InVan'])) $this->InVan = $o['InVan'];
        if (isset($o['Committed'])) $this->Committed = $o['Committed'];
        if (isset($o['Cap'])) $this->Cap = $o['Cap'];
        if (isset($o['CapUnit'])) $this->CapUnit = $o['CapUnit'];
        if (isset($o['VehicleUnit'])) $this->VehicleUnit = $o['VehicleUnit'];
        if (isset($o['CriticalCode'])) $this->CriticalCode = $o['CriticalCode'];
        if (isset($o['DriveMin'])) $this->DriveMin = $o['DriveMin'];
        if (isset($o['FacilityName'])) $this->FacilityName = $o['FacilityName'];
        if (isset($o['SendNote'])) $this->SendNote = $o['SendNote'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->State)) $o['State'] = $this->State;
        if (isset($this->LeaveByUtc)) $o['LeaveByUtc'] = JsonConverters::to('DateTime', $this->LeaveByUtc);
        if (isset($this->LeaveByText)) $o['LeaveByText'] = $this->LeaveByText;
        if (isset($this->SlackMin)) $o['SlackMin'] = $this->SlackMin;
        if (isset($this->InVan)) $o['InVan'] = $this->InVan;
        if (isset($this->Committed)) $o['Committed'] = $this->Committed;
        if (isset($this->Cap)) $o['Cap'] = $this->Cap;
        if (isset($this->CapUnit)) $o['CapUnit'] = $this->CapUnit;
        if (isset($this->VehicleUnit)) $o['VehicleUnit'] = $this->VehicleUnit;
        if (isset($this->CriticalCode)) $o['CriticalCode'] = $this->CriticalCode;
        if (isset($this->DriveMin)) $o['DriveMin'] = $this->DriveMin;
        if (isset($this->FacilityName)) $o['FacilityName'] = $this->FacilityName;
        if (isset($this->SendNote)) $o['SendNote'] = $this->SendNote;
        return empty($o) ? new class(){} : $o;
    }
}

class CourierItemView implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $CourierItemID=0,
        /** @var int */
        public int $DispatchOdRequestID=0,
        /** @var int */
        public int $Seq=0,
        /** @var string|null */
        public ?string $TagCode=null,
        /** @var string|null */
        public ?string $Custody=null,
        /** @var bool|null */
        public ?bool $IsOpen=null,
        /** @var bool|null */
        public ?bool $IsMissing=null,
        /** @var string|null */
        public ?string $MissingReason=null,
        /** @var bool|null */
        public ?bool $IsManual=null,
        /** @var bool|null */
        public ?bool $ReTagFlag=null,
        /** @var bool|null */
        public ?bool $Scanned=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CourierItemID'])) $this->CourierItemID = $o['CourierItemID'];
        if (isset($o['DispatchOdRequestID'])) $this->DispatchOdRequestID = $o['DispatchOdRequestID'];
        if (isset($o['Seq'])) $this->Seq = $o['Seq'];
        if (isset($o['TagCode'])) $this->TagCode = $o['TagCode'];
        if (isset($o['Custody'])) $this->Custody = $o['Custody'];
        if (isset($o['IsOpen'])) $this->IsOpen = $o['IsOpen'];
        if (isset($o['IsMissing'])) $this->IsMissing = $o['IsMissing'];
        if (isset($o['MissingReason'])) $this->MissingReason = $o['MissingReason'];
        if (isset($o['IsManual'])) $this->IsManual = $o['IsManual'];
        if (isset($o['ReTagFlag'])) $this->ReTagFlag = $o['ReTagFlag'];
        if (isset($o['Scanned'])) $this->Scanned = $o['Scanned'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CourierItemID)) $o['CourierItemID'] = $this->CourierItemID;
        if (isset($this->DispatchOdRequestID)) $o['DispatchOdRequestID'] = $this->DispatchOdRequestID;
        if (isset($this->Seq)) $o['Seq'] = $this->Seq;
        if (isset($this->TagCode)) $o['TagCode'] = $this->TagCode;
        if (isset($this->Custody)) $o['Custody'] = $this->Custody;
        if (isset($this->IsOpen)) $o['IsOpen'] = $this->IsOpen;
        if (isset($this->IsMissing)) $o['IsMissing'] = $this->IsMissing;
        if (isset($this->MissingReason)) $o['MissingReason'] = $this->MissingReason;
        if (isset($this->IsManual)) $o['IsManual'] = $this->IsManual;
        if (isset($this->ReTagFlag)) $o['ReTagFlag'] = $this->ReTagFlag;
        if (isset($this->Scanned)) $o['Scanned'] = $this->Scanned;
        return empty($o) ? new class(){} : $o;
    }
}

class CourierDriverOrder implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Code=null,
        /** @var string|null */
        public ?string $CourierStep=null,
        /** @var string|null */
        public ?string $RouteShape=null,
        /** @var string|null */
        public ?string $ProfileName=null,
        /** @var string|null */
        public ?string $UnitOne=null,
        /** @var string|null */
        public ?string $UnitMany=null,
        /** @var string|null */
        public ?string $FacilityNoun=null,
        /** @var string|null */
        public ?string $FacilityName=null,
        /** @var string|null */
        public ?string $LevelName=null,
        /** @var DateTime|null */
        public ?DateTime $DueUtc=null,
        /** @var string|null */
        public ?string $DueText=null,
        /** @var int */
        public int $Units=0,
        /** @var int|null */
        public ?int $UnitsFound=null,
        /** @var string|null */
        public ?string $Area=null,
        /** @var int|null */
        public ?int $Minutes=null,
        /** @var string|null */
        public ?string $Address=null,
        /** @var string|null */
        public ?string $Unit=null,
        /** @var string|null */
        public ?string $City=null,
        /** @var float|null */
        public ?float $Lat=null,
        /** @var float|null */
        public ?float $Lng=null,
        /** @var string|null */
        public ?string $CustomerName=null,
        /** @var string|null */
        public ?string $CustomerPhone=null,
        /** @var string|null */
        public ?string $Handoff=null,
        /** @var string|null */
        public ?string $GateCode=null,
        /** @var string|null */
        public ?string $Instructions=null,
        /** @var string|null */
        public ?string $DropoffAddress=null,
        /** @var string|null */
        public ?string $DropoffContactName=null,
        /** @var float|null */
        public ?float $DropLat=null,
        /** @var float|null */
        public ?float $DropLng=null,
        /** @var DateTime|null */
        public ?DateTime $ArrivedUtc=null,
        /** @var array<CourierItemView>|null */
        public ?array $Tags=null,
        /** @var array<string,string>|null */
        public ?array $Proof=null,
        /** @var array<string,int>|null */
        public ?array $Photos=null,
        /** @var array<string>|null */
        public ?array $Needs=null,
        /** @var int */
        public int $MissedWaitMin=0,
        /** @var bool|null */
        public ?bool $MissedRequireContact=null,
        /** @var bool|null */
        public ?bool $MissedRequirePhoto=null,
        /** @var float */
        public float $MissedFee=0.0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Code'])) $this->Code = $o['Code'];
        if (isset($o['CourierStep'])) $this->CourierStep = $o['CourierStep'];
        if (isset($o['RouteShape'])) $this->RouteShape = $o['RouteShape'];
        if (isset($o['ProfileName'])) $this->ProfileName = $o['ProfileName'];
        if (isset($o['UnitOne'])) $this->UnitOne = $o['UnitOne'];
        if (isset($o['UnitMany'])) $this->UnitMany = $o['UnitMany'];
        if (isset($o['FacilityNoun'])) $this->FacilityNoun = $o['FacilityNoun'];
        if (isset($o['FacilityName'])) $this->FacilityName = $o['FacilityName'];
        if (isset($o['LevelName'])) $this->LevelName = $o['LevelName'];
        if (isset($o['DueUtc'])) $this->DueUtc = JsonConverters::from('DateTime', $o['DueUtc']);
        if (isset($o['DueText'])) $this->DueText = $o['DueText'];
        if (isset($o['Units'])) $this->Units = $o['Units'];
        if (isset($o['UnitsFound'])) $this->UnitsFound = $o['UnitsFound'];
        if (isset($o['Area'])) $this->Area = $o['Area'];
        if (isset($o['Minutes'])) $this->Minutes = $o['Minutes'];
        if (isset($o['Address'])) $this->Address = $o['Address'];
        if (isset($o['Unit'])) $this->Unit = $o['Unit'];
        if (isset($o['City'])) $this->City = $o['City'];
        if (isset($o['Lat'])) $this->Lat = $o['Lat'];
        if (isset($o['Lng'])) $this->Lng = $o['Lng'];
        if (isset($o['CustomerName'])) $this->CustomerName = $o['CustomerName'];
        if (isset($o['CustomerPhone'])) $this->CustomerPhone = $o['CustomerPhone'];
        if (isset($o['Handoff'])) $this->Handoff = $o['Handoff'];
        if (isset($o['GateCode'])) $this->GateCode = $o['GateCode'];
        if (isset($o['Instructions'])) $this->Instructions = $o['Instructions'];
        if (isset($o['DropoffAddress'])) $this->DropoffAddress = $o['DropoffAddress'];
        if (isset($o['DropoffContactName'])) $this->DropoffContactName = $o['DropoffContactName'];
        if (isset($o['DropLat'])) $this->DropLat = $o['DropLat'];
        if (isset($o['DropLng'])) $this->DropLng = $o['DropLng'];
        if (isset($o['ArrivedUtc'])) $this->ArrivedUtc = JsonConverters::from('DateTime', $o['ArrivedUtc']);
        if (isset($o['Tags'])) $this->Tags = JsonConverters::fromArray('CourierItemView', $o['Tags']);
        if (isset($o['Proof'])) $this->Proof = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['Proof']);
        if (isset($o['Photos'])) $this->Photos = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','int']), $o['Photos']);
        if (isset($o['Needs'])) $this->Needs = JsonConverters::fromArray('string', $o['Needs']);
        if (isset($o['MissedWaitMin'])) $this->MissedWaitMin = $o['MissedWaitMin'];
        if (isset($o['MissedRequireContact'])) $this->MissedRequireContact = $o['MissedRequireContact'];
        if (isset($o['MissedRequirePhoto'])) $this->MissedRequirePhoto = $o['MissedRequirePhoto'];
        if (isset($o['MissedFee'])) $this->MissedFee = $o['MissedFee'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Code)) $o['Code'] = $this->Code;
        if (isset($this->CourierStep)) $o['CourierStep'] = $this->CourierStep;
        if (isset($this->RouteShape)) $o['RouteShape'] = $this->RouteShape;
        if (isset($this->ProfileName)) $o['ProfileName'] = $this->ProfileName;
        if (isset($this->UnitOne)) $o['UnitOne'] = $this->UnitOne;
        if (isset($this->UnitMany)) $o['UnitMany'] = $this->UnitMany;
        if (isset($this->FacilityNoun)) $o['FacilityNoun'] = $this->FacilityNoun;
        if (isset($this->FacilityName)) $o['FacilityName'] = $this->FacilityName;
        if (isset($this->LevelName)) $o['LevelName'] = $this->LevelName;
        if (isset($this->DueUtc)) $o['DueUtc'] = JsonConverters::to('DateTime', $this->DueUtc);
        if (isset($this->DueText)) $o['DueText'] = $this->DueText;
        if (isset($this->Units)) $o['Units'] = $this->Units;
        if (isset($this->UnitsFound)) $o['UnitsFound'] = $this->UnitsFound;
        if (isset($this->Area)) $o['Area'] = $this->Area;
        if (isset($this->Minutes)) $o['Minutes'] = $this->Minutes;
        if (isset($this->Address)) $o['Address'] = $this->Address;
        if (isset($this->Unit)) $o['Unit'] = $this->Unit;
        if (isset($this->City)) $o['City'] = $this->City;
        if (isset($this->Lat)) $o['Lat'] = $this->Lat;
        if (isset($this->Lng)) $o['Lng'] = $this->Lng;
        if (isset($this->CustomerName)) $o['CustomerName'] = $this->CustomerName;
        if (isset($this->CustomerPhone)) $o['CustomerPhone'] = $this->CustomerPhone;
        if (isset($this->Handoff)) $o['Handoff'] = $this->Handoff;
        if (isset($this->GateCode)) $o['GateCode'] = $this->GateCode;
        if (isset($this->Instructions)) $o['Instructions'] = $this->Instructions;
        if (isset($this->DropoffAddress)) $o['DropoffAddress'] = $this->DropoffAddress;
        if (isset($this->DropoffContactName)) $o['DropoffContactName'] = $this->DropoffContactName;
        if (isset($this->DropLat)) $o['DropLat'] = $this->DropLat;
        if (isset($this->DropLng)) $o['DropLng'] = $this->DropLng;
        if (isset($this->ArrivedUtc)) $o['ArrivedUtc'] = JsonConverters::to('DateTime', $this->ArrivedUtc);
        if (isset($this->Tags)) $o['Tags'] = JsonConverters::toArray('CourierItemView', $this->Tags);
        if (isset($this->Proof)) $o['Proof'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->Proof);
        if (isset($this->Photos)) $o['Photos'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','int']), $this->Photos);
        if (isset($this->Needs)) $o['Needs'] = JsonConverters::toArray('string', $this->Needs);
        if (isset($this->MissedWaitMin)) $o['MissedWaitMin'] = $this->MissedWaitMin;
        if (isset($this->MissedRequireContact)) $o['MissedRequireContact'] = $this->MissedRequireContact;
        if (isset($this->MissedRequirePhoto)) $o['MissedRequirePhoto'] = $this->MissedRequirePhoto;
        if (isset($this->MissedFee)) $o['MissedFee'] = $this->MissedFee;
        return empty($o) ? new class(){} : $o;
    }
}

class CourierStopView implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Sequence=0,
        /** @var string|null */
        public ?string $Status=null,
        /** @var int */
        public int $DispatchOdRequestID=0,
        /** @var string|null */
        public ?string $Code=null,
        /** @var string|null */
        public ?string $CourierStep=null,
        /** @var string|null */
        public ?string $Address=null,
        /** @var string|null */
        public ?string $Unit=null,
        /** @var string|null */
        public ?string $City=null,
        /** @var string|null */
        public ?string $Zip=null,
        /** @var float|null */
        public ?float $Lat=null,
        /** @var float|null */
        public ?float $Lng=null,
        /** @var string|null */
        public ?string $CustomerName=null,
        /** @var string|null */
        public ?string $CustomerPhone=null,
        /** @var string|null */
        public ?string $Handoff=null,
        /** @var string|null */
        public ?string $GateCode=null,
        /** @var string|null */
        public ?string $Instructions=null,
        /** @var int */
        public int $Units=0,
        /** @var string|null */
        public ?string $DueText=null,
        /** @var string|null */
        public ?string $Note=null,
        /** @var array<string>|null */
        public ?array $Needs=null,
        /** @var array<CourierItemView>|null */
        public ?array $Items=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Sequence'])) $this->Sequence = $o['Sequence'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['DispatchOdRequestID'])) $this->DispatchOdRequestID = $o['DispatchOdRequestID'];
        if (isset($o['Code'])) $this->Code = $o['Code'];
        if (isset($o['CourierStep'])) $this->CourierStep = $o['CourierStep'];
        if (isset($o['Address'])) $this->Address = $o['Address'];
        if (isset($o['Unit'])) $this->Unit = $o['Unit'];
        if (isset($o['City'])) $this->City = $o['City'];
        if (isset($o['Zip'])) $this->Zip = $o['Zip'];
        if (isset($o['Lat'])) $this->Lat = $o['Lat'];
        if (isset($o['Lng'])) $this->Lng = $o['Lng'];
        if (isset($o['CustomerName'])) $this->CustomerName = $o['CustomerName'];
        if (isset($o['CustomerPhone'])) $this->CustomerPhone = $o['CustomerPhone'];
        if (isset($o['Handoff'])) $this->Handoff = $o['Handoff'];
        if (isset($o['GateCode'])) $this->GateCode = $o['GateCode'];
        if (isset($o['Instructions'])) $this->Instructions = $o['Instructions'];
        if (isset($o['Units'])) $this->Units = $o['Units'];
        if (isset($o['DueText'])) $this->DueText = $o['DueText'];
        if (isset($o['Note'])) $this->Note = $o['Note'];
        if (isset($o['Needs'])) $this->Needs = JsonConverters::fromArray('string', $o['Needs']);
        if (isset($o['Items'])) $this->Items = JsonConverters::fromArray('CourierItemView', $o['Items']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Sequence)) $o['Sequence'] = $this->Sequence;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->DispatchOdRequestID)) $o['DispatchOdRequestID'] = $this->DispatchOdRequestID;
        if (isset($this->Code)) $o['Code'] = $this->Code;
        if (isset($this->CourierStep)) $o['CourierStep'] = $this->CourierStep;
        if (isset($this->Address)) $o['Address'] = $this->Address;
        if (isset($this->Unit)) $o['Unit'] = $this->Unit;
        if (isset($this->City)) $o['City'] = $this->City;
        if (isset($this->Zip)) $o['Zip'] = $this->Zip;
        if (isset($this->Lat)) $o['Lat'] = $this->Lat;
        if (isset($this->Lng)) $o['Lng'] = $this->Lng;
        if (isset($this->CustomerName)) $o['CustomerName'] = $this->CustomerName;
        if (isset($this->CustomerPhone)) $o['CustomerPhone'] = $this->CustomerPhone;
        if (isset($this->Handoff)) $o['Handoff'] = $this->Handoff;
        if (isset($this->GateCode)) $o['GateCode'] = $this->GateCode;
        if (isset($this->Instructions)) $o['Instructions'] = $this->Instructions;
        if (isset($this->Units)) $o['Units'] = $this->Units;
        if (isset($this->DueText)) $o['DueText'] = $this->DueText;
        if (isset($this->Note)) $o['Note'] = $this->Note;
        if (isset($this->Needs)) $o['Needs'] = JsonConverters::toArray('string', $this->Needs);
        if (isset($this->Items)) $o['Items'] = JsonConverters::toArray('CourierItemView', $this->Items);
        return empty($o) ? new class(){} : $o;
    }
}

class CourierRunView implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $CourierRunID=0,
        /** @var string|null */
        public ?string $Code=null,
        /** @var string|null */
        public ?string $Status=null,
        /** @var int */
        public int $CourierProfileId=0,
        /** @var string|null */
        public ?string $ProfileName=null,
        /** @var int */
        public int $CourierFacilityId=0,
        /** @var string|null */
        public ?string $FacilityName=null,
        /** @var string|null */
        public ?string $FacilityAddress=null,
        /** @var int|null */
        public ?int $DriverContactId=null,
        /** @var string|null */
        public ?string $DriverName=null,
        /** @var int|null */
        public ?int $EquipmentID=null,
        /** @var string|null */
        public ?string $VehicleUnit=null,
        /** @var string|null */
        public ?string $UnitOne=null,
        /** @var string|null */
        public ?string $UnitMany=null,
        /** @var int */
        public int $Units=0,
        /** @var int */
        public int $StopCount=0,
        /** @var int */
        public int $StopsDone=0,
        /** @var float|null */
        public ?float $Pay=null,
        /** @var DateTime|null */
        public ?DateTime $BuiltUtc=null,
        /** @var DateTime|null */
        public ?DateTime $StartedUtc=null,
        /** @var DateTime|null */
        public ?DateTime $CompletedUtc=null,
        /** @var int */
        public int $ToLoad=0,
        /** @var int */
        public int $ToReturn=0,
        /** @var array<CourierStopView>|null */
        public ?array $Stops=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CourierRunID'])) $this->CourierRunID = $o['CourierRunID'];
        if (isset($o['Code'])) $this->Code = $o['Code'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['CourierProfileId'])) $this->CourierProfileId = $o['CourierProfileId'];
        if (isset($o['ProfileName'])) $this->ProfileName = $o['ProfileName'];
        if (isset($o['CourierFacilityId'])) $this->CourierFacilityId = $o['CourierFacilityId'];
        if (isset($o['FacilityName'])) $this->FacilityName = $o['FacilityName'];
        if (isset($o['FacilityAddress'])) $this->FacilityAddress = $o['FacilityAddress'];
        if (isset($o['DriverContactId'])) $this->DriverContactId = $o['DriverContactId'];
        if (isset($o['DriverName'])) $this->DriverName = $o['DriverName'];
        if (isset($o['EquipmentID'])) $this->EquipmentID = $o['EquipmentID'];
        if (isset($o['VehicleUnit'])) $this->VehicleUnit = $o['VehicleUnit'];
        if (isset($o['UnitOne'])) $this->UnitOne = $o['UnitOne'];
        if (isset($o['UnitMany'])) $this->UnitMany = $o['UnitMany'];
        if (isset($o['Units'])) $this->Units = $o['Units'];
        if (isset($o['StopCount'])) $this->StopCount = $o['StopCount'];
        if (isset($o['StopsDone'])) $this->StopsDone = $o['StopsDone'];
        if (isset($o['Pay'])) $this->Pay = $o['Pay'];
        if (isset($o['BuiltUtc'])) $this->BuiltUtc = JsonConverters::from('DateTime', $o['BuiltUtc']);
        if (isset($o['StartedUtc'])) $this->StartedUtc = JsonConverters::from('DateTime', $o['StartedUtc']);
        if (isset($o['CompletedUtc'])) $this->CompletedUtc = JsonConverters::from('DateTime', $o['CompletedUtc']);
        if (isset($o['ToLoad'])) $this->ToLoad = $o['ToLoad'];
        if (isset($o['ToReturn'])) $this->ToReturn = $o['ToReturn'];
        if (isset($o['Stops'])) $this->Stops = JsonConverters::fromArray('CourierStopView', $o['Stops']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CourierRunID)) $o['CourierRunID'] = $this->CourierRunID;
        if (isset($this->Code)) $o['Code'] = $this->Code;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->CourierProfileId)) $o['CourierProfileId'] = $this->CourierProfileId;
        if (isset($this->ProfileName)) $o['ProfileName'] = $this->ProfileName;
        if (isset($this->CourierFacilityId)) $o['CourierFacilityId'] = $this->CourierFacilityId;
        if (isset($this->FacilityName)) $o['FacilityName'] = $this->FacilityName;
        if (isset($this->FacilityAddress)) $o['FacilityAddress'] = $this->FacilityAddress;
        if (isset($this->DriverContactId)) $o['DriverContactId'] = $this->DriverContactId;
        if (isset($this->DriverName)) $o['DriverName'] = $this->DriverName;
        if (isset($this->EquipmentID)) $o['EquipmentID'] = $this->EquipmentID;
        if (isset($this->VehicleUnit)) $o['VehicleUnit'] = $this->VehicleUnit;
        if (isset($this->UnitOne)) $o['UnitOne'] = $this->UnitOne;
        if (isset($this->UnitMany)) $o['UnitMany'] = $this->UnitMany;
        if (isset($this->Units)) $o['Units'] = $this->Units;
        if (isset($this->StopCount)) $o['StopCount'] = $this->StopCount;
        if (isset($this->StopsDone)) $o['StopsDone'] = $this->StopsDone;
        if (isset($this->Pay)) $o['Pay'] = $this->Pay;
        if (isset($this->BuiltUtc)) $o['BuiltUtc'] = JsonConverters::to('DateTime', $this->BuiltUtc);
        if (isset($this->StartedUtc)) $o['StartedUtc'] = JsonConverters::to('DateTime', $this->StartedUtc);
        if (isset($this->CompletedUtc)) $o['CompletedUtc'] = JsonConverters::to('DateTime', $this->CompletedUtc);
        if (isset($this->ToLoad)) $o['ToLoad'] = $this->ToLoad;
        if (isset($this->ToReturn)) $o['ToReturn'] = $this->ToReturn;
        if (isset($this->Stops)) $o['Stops'] = JsonConverters::toArray('CourierStopView', $this->Stops);
        return empty($o) ? new class(){} : $o;
    }
}

class CourierDriverView implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $DriverCode=null,
        /** @var string|null */
        public ?string $Name=null,
        /** @var bool|null */
        public ?bool $Online=null,
        /** @var bool|null */
        public ?bool $OnRoster=null,
        /** @var CourierVanView|null */
        public ?CourierVanView $Van=null,
        /** @var CourierDriverOrder|null */
        public ?CourierDriverOrder $Current=null,
        /** @var array<CourierDriverOrder>|null */
        public ?array $Queue=null,
        /** @var array<CourierDriverOrder>|null */
        public ?array $Aboard=null,
        /** @var array<CourierRunView>|null */
        public ?array $Runs=null,
        /** @var CourierDriverOrder|null */
        public ?CourierDriverOrder $UpNext=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['DriverCode'])) $this->DriverCode = $o['DriverCode'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Online'])) $this->Online = $o['Online'];
        if (isset($o['OnRoster'])) $this->OnRoster = $o['OnRoster'];
        if (isset($o['Van'])) $this->Van = JsonConverters::from('CourierVanView', $o['Van']);
        if (isset($o['Current'])) $this->Current = JsonConverters::from('CourierDriverOrder', $o['Current']);
        if (isset($o['Queue'])) $this->Queue = JsonConverters::fromArray('CourierDriverOrder', $o['Queue']);
        if (isset($o['Aboard'])) $this->Aboard = JsonConverters::fromArray('CourierDriverOrder', $o['Aboard']);
        if (isset($o['Runs'])) $this->Runs = JsonConverters::fromArray('CourierRunView', $o['Runs']);
        if (isset($o['UpNext'])) $this->UpNext = JsonConverters::from('CourierDriverOrder', $o['UpNext']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->DriverCode)) $o['DriverCode'] = $this->DriverCode;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Online)) $o['Online'] = $this->Online;
        if (isset($this->OnRoster)) $o['OnRoster'] = $this->OnRoster;
        if (isset($this->Van)) $o['Van'] = JsonConverters::to('CourierVanView', $this->Van);
        if (isset($this->Current)) $o['Current'] = JsonConverters::to('CourierDriverOrder', $this->Current);
        if (isset($this->Queue)) $o['Queue'] = JsonConverters::toArray('CourierDriverOrder', $this->Queue);
        if (isset($this->Aboard)) $o['Aboard'] = JsonConverters::toArray('CourierDriverOrder', $this->Aboard);
        if (isset($this->Runs)) $o['Runs'] = JsonConverters::toArray('CourierRunView', $this->Runs);
        if (isset($this->UpNext)) $o['UpNext'] = JsonConverters::to('CourierDriverOrder', $this->UpNext);
        return empty($o) ? new class(){} : $o;
    }
}

class CourierDriverResponse implements JsonSerializable
{
    public function __construct(
        /** @var CourierDriverView|null */
        public ?CourierDriverView $Courier=null,
        /** @var string|null */
        public ?string $Result=null,
        /** @var string|null */
        public ?string $Detail=null,
        /** @var string|null */
        public ?string $Message=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

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

class CourierRunReturnScanRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $RunId=0,
        /** @var string|null */
        public ?string $TagCode=null,
        /** @var float|null */
        public ?float $Lat=null,
        /** @var float|null */
        public ?float $Lng=null
    ) {
    }

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

PHP CourierRunReturnScanRequest DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

POST /v1/worker/dispatch/od/runs/{RunId}/returns HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"RunId":0,"TagCode":"String","Lat":0,"Lng":0}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Courier":{"DriverCode":"String","Name":"String","Online":false,"OnRoster":false,"Van":{"State":"String","LeaveByUtc":"0001-01-01T00:00:00.0000000","LeaveByText":"String","SlackMin":0,"InVan":0,"Committed":0,"Cap":0,"CapUnit":"String","VehicleUnit":"String","CriticalCode":"String","DriveMin":0,"FacilityName":"String","SendNote":"String"},"Current":{"Code":"String","CourierStep":"String","RouteShape":"String","ProfileName":"String","UnitOne":"String","UnitMany":"String","FacilityNoun":"String","FacilityName":"String","LevelName":"String","DueUtc":"0001-01-01T00:00:00.0000000","DueText":"String","Units":0,"UnitsFound":0,"Area":"String","Minutes":0,"Address":"String","Unit":"String","City":"String","Lat":0,"Lng":0,"CustomerName":"String","CustomerPhone":"String","Handoff":"String","GateCode":"String","Instructions":"String","DropoffAddress":"String","DropoffContactName":"String","DropLat":0,"DropLng":0,"ArrivedUtc":"0001-01-01T00:00:00.0000000","Tags":[{"CourierItemID":0,"DispatchOdRequestID":0,"Seq":0,"TagCode":"String","Custody":"String","IsOpen":false,"IsMissing":false,"MissingReason":"String","IsManual":false,"ReTagFlag":false,"Scanned":false}],"Proof":{"String":"String"},"Photos":{"String":0},"Needs":["String"],"MissedWaitMin":0,"MissedRequireContact":false,"MissedRequirePhoto":false,"MissedFee":0},"Queue":[{"Code":"String","CourierStep":"String","RouteShape":"String","ProfileName":"String","UnitOne":"String","UnitMany":"String","FacilityNoun":"String","FacilityName":"String","LevelName":"String","DueUtc":"0001-01-01T00:00:00.0000000","DueText":"String","Units":0,"UnitsFound":0,"Area":"String","Minutes":0,"Address":"String","Unit":"String","City":"String","Lat":0,"Lng":0,"CustomerName":"String","CustomerPhone":"String","Handoff":"String","GateCode":"String","Instructions":"String","DropoffAddress":"String","DropoffContactName":"String","DropLat":0,"DropLng":0,"ArrivedUtc":"0001-01-01T00:00:00.0000000","Tags":[{"CourierItemID":0,"DispatchOdRequestID":0,"Seq":0,"TagCode":"String","Custody":"String","IsOpen":false,"IsMissing":false,"MissingReason":"String","IsManual":false,"ReTagFlag":false,"Scanned":false}],"Proof":{"String":"String"},"Photos":{"String":0},"Needs":["String"],"MissedWaitMin":0,"MissedRequireContact":false,"MissedRequirePhoto":false,"MissedFee":0}],"Aboard":[{"Code":"String","CourierStep":"String","RouteShape":"String","ProfileName":"String","UnitOne":"String","UnitMany":"String","FacilityNoun":"String","FacilityName":"String","LevelName":"String","DueUtc":"0001-01-01T00:00:00.0000000","DueText":"String","Units":0,"UnitsFound":0,"Area":"String","Minutes":0,"Address":"String","Unit":"String","City":"String","Lat":0,"Lng":0,"CustomerName":"String","CustomerPhone":"String","Handoff":"String","GateCode":"String","Instructions":"String","DropoffAddress":"String","DropoffContactName":"String","DropLat":0,"DropLng":0,"ArrivedUtc":"0001-01-01T00:00:00.0000000","Tags":[{"CourierItemID":0,"DispatchOdRequestID":0,"Seq":0,"TagCode":"String","Custody":"String","IsOpen":false,"IsMissing":false,"MissingReason":"String","IsManual":false,"ReTagFlag":false,"Scanned":false}],"Proof":{"String":"String"},"Photos":{"String":0},"Needs":["String"],"MissedWaitMin":0,"MissedRequireContact":false,"MissedRequirePhoto":false,"MissedFee":0}],"Runs":[{"CourierRunID":0,"Code":"String","Status":"String","CourierProfileId":0,"ProfileName":"String","CourierFacilityId":0,"FacilityName":"String","FacilityAddress":"String","DriverContactId":0,"DriverName":"String","EquipmentID":0,"VehicleUnit":"String","UnitOne":"String","UnitMany":"String","Units":0,"StopCount":0,"StopsDone":0,"Pay":0,"BuiltUtc":"0001-01-01T00:00:00.0000000","StartedUtc":"0001-01-01T00:00:00.0000000","CompletedUtc":"0001-01-01T00:00:00.0000000","ToLoad":0,"ToReturn":0,"Stops":[{"Sequence":0,"Status":"String","DispatchOdRequestID":0,"Code":"String","CourierStep":"String","Address":"String","Unit":"String","City":"String","Zip":"String","Lat":0,"Lng":0,"CustomerName":"String","CustomerPhone":"String","Handoff":"String","GateCode":"String","Instructions":"String","Units":0,"DueText":"String","Note":"String","Needs":["String"],"Items":[{"CourierItemID":0,"DispatchOdRequestID":0,"Seq":0,"TagCode":"String","Custody":"String","IsOpen":false,"IsMissing":false,"MissingReason":"String","IsManual":false,"ReTagFlag":false,"Scanned":false}]}]}],"UpNext":{"Code":"String","CourierStep":"String","RouteShape":"String","ProfileName":"String","UnitOne":"String","UnitMany":"String","FacilityNoun":"String","FacilityName":"String","LevelName":"String","DueUtc":"0001-01-01T00:00:00.0000000","DueText":"String","Units":0,"UnitsFound":0,"Area":"String","Minutes":0,"Address":"String","Unit":"String","City":"String","Lat":0,"Lng":0,"CustomerName":"String","CustomerPhone":"String","Handoff":"String","GateCode":"String","Instructions":"String","DropoffAddress":"String","DropoffContactName":"String","DropLat":0,"DropLng":0,"ArrivedUtc":"0001-01-01T00:00:00.0000000","Tags":[{"CourierItemID":0,"DispatchOdRequestID":0,"Seq":0,"TagCode":"String","Custody":"String","IsOpen":false,"IsMissing":false,"MissingReason":"String","IsManual":false,"ReTagFlag":false,"Scanned":false}],"Proof":{"String":"String"},"Photos":{"String":0},"Needs":["String"],"MissedWaitMin":0,"MissedRequireContact":false,"MissedRequirePhoto":false,"MissedFee":0}},"Result":"String","Detail":"String","Message":"String","ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}