Trendsic Platform Service

<back to all web services

InspectionReportRequest

Requires Authentication
The following routes are available for this service:
GET,OPTIONS/v1/inspections/{InspectionUID}/report
<?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 InspectionPhoto implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $AttachmentId='',
        /** @var string|null */
        public ?string $FileName=null,
        /** @var string|null */
        public ?string $Url=null,
        /** @var string|null */
        public ?string $CreatedBy=null,
        /** @var DateTime|null */
        public ?DateTime $CreatedDate=null,
        /** @var bool|null */
        public ?bool $HasAnnotation=null,
        /** @var string|null */
        public ?string $AnnotatedAttachmentId=null,
        /** @var string|null */
        public ?string $AnnotatedUrl=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['AttachmentId'])) $this->AttachmentId = $o['AttachmentId'];
        if (isset($o['FileName'])) $this->FileName = $o['FileName'];
        if (isset($o['Url'])) $this->Url = $o['Url'];
        if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
        if (isset($o['CreatedDate'])) $this->CreatedDate = JsonConverters::from('DateTime', $o['CreatedDate']);
        if (isset($o['HasAnnotation'])) $this->HasAnnotation = $o['HasAnnotation'];
        if (isset($o['AnnotatedAttachmentId'])) $this->AnnotatedAttachmentId = $o['AnnotatedAttachmentId'];
        if (isset($o['AnnotatedUrl'])) $this->AnnotatedUrl = $o['AnnotatedUrl'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->AttachmentId)) $o['AttachmentId'] = $this->AttachmentId;
        if (isset($this->FileName)) $o['FileName'] = $this->FileName;
        if (isset($this->Url)) $o['Url'] = $this->Url;
        if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
        if (isset($this->CreatedDate)) $o['CreatedDate'] = JsonConverters::to('DateTime', $this->CreatedDate);
        if (isset($this->HasAnnotation)) $o['HasAnnotation'] = $this->HasAnnotation;
        if (isset($this->AnnotatedAttachmentId)) $o['AnnotatedAttachmentId'] = $this->AnnotatedAttachmentId;
        if (isset($this->AnnotatedUrl)) $o['AnnotatedUrl'] = $this->AnnotatedUrl;
        return empty($o) ? new class(){} : $o;
    }
}

class InspectionItem implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $InspectionItemID=0,
        /** @var int */
        public int $InspectionID=0,
        /** @var int */
        public int $Seq=0,
        /** @var string|null */
        public ?string $Section=null,
        /** @var string|null */
        public ?string $Prompt=null,
        /** @var string|null */
        public ?string $ResponseType=null,
        /** @var bool|null */
        public ?bool $IsRequired=null,
        /** @var string|null */
        public ?string $Unit=null,
        /** @var string|null */
        public ?string $Guidance=null,
        /** @var string|null */
        public ?string $Result=null,
        /** @var string|null */
        public ?string $Value=null,
        /** @var string|null */
        public ?string $Notes=null,
        /** @var int */
        public int $PhotoCount=0,
        /** @var int|null */
        public ?int $LinkedPunchItemID=null,
        /** @var string|null */
        public ?string $LinkedPunchNo=null,
        /** @var string|null */
        public ?string $LinkedPunchStatus=null,
        /** @var int|null */
        public ?int $LinkedNcrID=null,
        /** @var string|null */
        public ?string $LinkedNcrNo=null,
        /** @var int|null */
        public ?int $LinkedActionID=null,
        /** @var string|null */
        public ?string $AnsweredBy=null,
        /** @var DateTime|null */
        public ?DateTime $AnsweredAt=null,
        /** @var array<InspectionPhoto>|null */
        public ?array $Photos=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['InspectionItemID'])) $this->InspectionItemID = $o['InspectionItemID'];
        if (isset($o['InspectionID'])) $this->InspectionID = $o['InspectionID'];
        if (isset($o['Seq'])) $this->Seq = $o['Seq'];
        if (isset($o['Section'])) $this->Section = $o['Section'];
        if (isset($o['Prompt'])) $this->Prompt = $o['Prompt'];
        if (isset($o['ResponseType'])) $this->ResponseType = $o['ResponseType'];
        if (isset($o['IsRequired'])) $this->IsRequired = $o['IsRequired'];
        if (isset($o['Unit'])) $this->Unit = $o['Unit'];
        if (isset($o['Guidance'])) $this->Guidance = $o['Guidance'];
        if (isset($o['Result'])) $this->Result = $o['Result'];
        if (isset($o['Value'])) $this->Value = $o['Value'];
        if (isset($o['Notes'])) $this->Notes = $o['Notes'];
        if (isset($o['PhotoCount'])) $this->PhotoCount = $o['PhotoCount'];
        if (isset($o['LinkedPunchItemID'])) $this->LinkedPunchItemID = $o['LinkedPunchItemID'];
        if (isset($o['LinkedPunchNo'])) $this->LinkedPunchNo = $o['LinkedPunchNo'];
        if (isset($o['LinkedPunchStatus'])) $this->LinkedPunchStatus = $o['LinkedPunchStatus'];
        if (isset($o['LinkedNcrID'])) $this->LinkedNcrID = $o['LinkedNcrID'];
        if (isset($o['LinkedNcrNo'])) $this->LinkedNcrNo = $o['LinkedNcrNo'];
        if (isset($o['LinkedActionID'])) $this->LinkedActionID = $o['LinkedActionID'];
        if (isset($o['AnsweredBy'])) $this->AnsweredBy = $o['AnsweredBy'];
        if (isset($o['AnsweredAt'])) $this->AnsweredAt = JsonConverters::from('DateTime', $o['AnsweredAt']);
        if (isset($o['Photos'])) $this->Photos = JsonConverters::fromArray('InspectionPhoto', $o['Photos']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->InspectionItemID)) $o['InspectionItemID'] = $this->InspectionItemID;
        if (isset($this->InspectionID)) $o['InspectionID'] = $this->InspectionID;
        if (isset($this->Seq)) $o['Seq'] = $this->Seq;
        if (isset($this->Section)) $o['Section'] = $this->Section;
        if (isset($this->Prompt)) $o['Prompt'] = $this->Prompt;
        if (isset($this->ResponseType)) $o['ResponseType'] = $this->ResponseType;
        if (isset($this->IsRequired)) $o['IsRequired'] = $this->IsRequired;
        if (isset($this->Unit)) $o['Unit'] = $this->Unit;
        if (isset($this->Guidance)) $o['Guidance'] = $this->Guidance;
        if (isset($this->Result)) $o['Result'] = $this->Result;
        if (isset($this->Value)) $o['Value'] = $this->Value;
        if (isset($this->Notes)) $o['Notes'] = $this->Notes;
        if (isset($this->PhotoCount)) $o['PhotoCount'] = $this->PhotoCount;
        if (isset($this->LinkedPunchItemID)) $o['LinkedPunchItemID'] = $this->LinkedPunchItemID;
        if (isset($this->LinkedPunchNo)) $o['LinkedPunchNo'] = $this->LinkedPunchNo;
        if (isset($this->LinkedPunchStatus)) $o['LinkedPunchStatus'] = $this->LinkedPunchStatus;
        if (isset($this->LinkedNcrID)) $o['LinkedNcrID'] = $this->LinkedNcrID;
        if (isset($this->LinkedNcrNo)) $o['LinkedNcrNo'] = $this->LinkedNcrNo;
        if (isset($this->LinkedActionID)) $o['LinkedActionID'] = $this->LinkedActionID;
        if (isset($this->AnsweredBy)) $o['AnsweredBy'] = $this->AnsweredBy;
        if (isset($this->AnsweredAt)) $o['AnsweredAt'] = JsonConverters::to('DateTime', $this->AnsweredAt);
        if (isset($this->Photos)) $o['Photos'] = JsonConverters::toArray('InspectionPhoto', $this->Photos);
        return empty($o) ? new class(){} : $o;
    }
}

class InspectionRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $InspectionRequestID=0,
        /** @var int */
        public int $InspectionID=0,
        /** @var string|null */
        public ?string $Agency=null,
        /** @var string|null */
        public ?string $ContactName=null,
        /** @var string|null */
        public ?string $ContactPhone=null,
        /** @var string|null */
        public ?string $PermitNo=null,
        /** @var DateTime|null */
        public ?DateTime $RequestedDate=null,
        /** @var string|null */
        public ?string $RequestedWindow=null,
        /** @var string|null */
        public ?string $Status=null,
        /** @var string|null */
        public ?string $ConfirmationNo=null,
        /** @var string|null */
        public ?string $Outcome=null,
        /** @var string|null */
        public ?string $CreatedBy=null,
        /** @var DateTime|null */
        public ?DateTime $CreatedAt=null,
        /** @var DateTime|null */
        public ?DateTime $UpdatedAt=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['InspectionRequestID'])) $this->InspectionRequestID = $o['InspectionRequestID'];
        if (isset($o['InspectionID'])) $this->InspectionID = $o['InspectionID'];
        if (isset($o['Agency'])) $this->Agency = $o['Agency'];
        if (isset($o['ContactName'])) $this->ContactName = $o['ContactName'];
        if (isset($o['ContactPhone'])) $this->ContactPhone = $o['ContactPhone'];
        if (isset($o['PermitNo'])) $this->PermitNo = $o['PermitNo'];
        if (isset($o['RequestedDate'])) $this->RequestedDate = JsonConverters::from('DateTime', $o['RequestedDate']);
        if (isset($o['RequestedWindow'])) $this->RequestedWindow = $o['RequestedWindow'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['ConfirmationNo'])) $this->ConfirmationNo = $o['ConfirmationNo'];
        if (isset($o['Outcome'])) $this->Outcome = $o['Outcome'];
        if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
        if (isset($o['CreatedAt'])) $this->CreatedAt = JsonConverters::from('DateTime', $o['CreatedAt']);
        if (isset($o['UpdatedAt'])) $this->UpdatedAt = JsonConverters::from('DateTime', $o['UpdatedAt']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->InspectionRequestID)) $o['InspectionRequestID'] = $this->InspectionRequestID;
        if (isset($this->InspectionID)) $o['InspectionID'] = $this->InspectionID;
        if (isset($this->Agency)) $o['Agency'] = $this->Agency;
        if (isset($this->ContactName)) $o['ContactName'] = $this->ContactName;
        if (isset($this->ContactPhone)) $o['ContactPhone'] = $this->ContactPhone;
        if (isset($this->PermitNo)) $o['PermitNo'] = $this->PermitNo;
        if (isset($this->RequestedDate)) $o['RequestedDate'] = JsonConverters::to('DateTime', $this->RequestedDate);
        if (isset($this->RequestedWindow)) $o['RequestedWindow'] = $this->RequestedWindow;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->ConfirmationNo)) $o['ConfirmationNo'] = $this->ConfirmationNo;
        if (isset($this->Outcome)) $o['Outcome'] = $this->Outcome;
        if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
        if (isset($this->CreatedAt)) $o['CreatedAt'] = JsonConverters::to('DateTime', $this->CreatedAt);
        if (isset($this->UpdatedAt)) $o['UpdatedAt'] = JsonConverters::to('DateTime', $this->UpdatedAt);
        return empty($o) ? new class(){} : $o;
    }
}

class SignatureRecord implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $SignatureRecordID=0,
        /** @var string|null */
        public ?string $EntityType=null,
        /** @var int */
        public int $EntityID=0,
        /** @var string|null */
        public ?string $Role=null,
        /** @var string|null */
        public ?string $SignerName=null,
        /** @var int|null */
        public ?int $SignerContactID=null,
        /** @var string|null */
        public ?string $SignerUserId=null,
        /** @var string|null */
        public ?string $Method=null,
        /** @var string|null */
        public ?string $ImageAttachmentId=null,
        /** @var string|null */
        public ?string $ImageUrl=null,
        /** @var string|null */
        public ?string $ImageHash=null,
        /** @var string|null */
        public ?string $DocumentHash=null,
        /** @var string|null */
        public ?string $ConsentText=null,
        /** @var string|null */
        public ?string $IpAddress=null,
        /** @var string|null */
        public ?string $UserAgent=null,
        /** @var DateTime|null */
        public ?DateTime $SignedAt=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['SignatureRecordID'])) $this->SignatureRecordID = $o['SignatureRecordID'];
        if (isset($o['EntityType'])) $this->EntityType = $o['EntityType'];
        if (isset($o['EntityID'])) $this->EntityID = $o['EntityID'];
        if (isset($o['Role'])) $this->Role = $o['Role'];
        if (isset($o['SignerName'])) $this->SignerName = $o['SignerName'];
        if (isset($o['SignerContactID'])) $this->SignerContactID = $o['SignerContactID'];
        if (isset($o['SignerUserId'])) $this->SignerUserId = $o['SignerUserId'];
        if (isset($o['Method'])) $this->Method = $o['Method'];
        if (isset($o['ImageAttachmentId'])) $this->ImageAttachmentId = $o['ImageAttachmentId'];
        if (isset($o['ImageUrl'])) $this->ImageUrl = $o['ImageUrl'];
        if (isset($o['ImageHash'])) $this->ImageHash = $o['ImageHash'];
        if (isset($o['DocumentHash'])) $this->DocumentHash = $o['DocumentHash'];
        if (isset($o['ConsentText'])) $this->ConsentText = $o['ConsentText'];
        if (isset($o['IpAddress'])) $this->IpAddress = $o['IpAddress'];
        if (isset($o['UserAgent'])) $this->UserAgent = $o['UserAgent'];
        if (isset($o['SignedAt'])) $this->SignedAt = JsonConverters::from('DateTime', $o['SignedAt']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->SignatureRecordID)) $o['SignatureRecordID'] = $this->SignatureRecordID;
        if (isset($this->EntityType)) $o['EntityType'] = $this->EntityType;
        if (isset($this->EntityID)) $o['EntityID'] = $this->EntityID;
        if (isset($this->Role)) $o['Role'] = $this->Role;
        if (isset($this->SignerName)) $o['SignerName'] = $this->SignerName;
        if (isset($this->SignerContactID)) $o['SignerContactID'] = $this->SignerContactID;
        if (isset($this->SignerUserId)) $o['SignerUserId'] = $this->SignerUserId;
        if (isset($this->Method)) $o['Method'] = $this->Method;
        if (isset($this->ImageAttachmentId)) $o['ImageAttachmentId'] = $this->ImageAttachmentId;
        if (isset($this->ImageUrl)) $o['ImageUrl'] = $this->ImageUrl;
        if (isset($this->ImageHash)) $o['ImageHash'] = $this->ImageHash;
        if (isset($this->DocumentHash)) $o['DocumentHash'] = $this->DocumentHash;
        if (isset($this->ConsentText)) $o['ConsentText'] = $this->ConsentText;
        if (isset($this->IpAddress)) $o['IpAddress'] = $this->IpAddress;
        if (isset($this->UserAgent)) $o['UserAgent'] = $this->UserAgent;
        if (isset($this->SignedAt)) $o['SignedAt'] = JsonConverters::to('DateTime', $this->SignedAt);
        return empty($o) ? new class(){} : $o;
    }
}

class Inspection implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $InspectionID=0,
        /** @var string */
        public string $InspectionUID='',
        /** @var int */
        public int $ProjectID=0,
        /** @var string|null */
        public ?string $ProjectName=null,
        /** @var int|null */
        public ?int $JobID=null,
        /** @var string|null */
        public ?string $JobName=null,
        /** @var string|null */
        public ?string $InspectionNo=null,
        /** @var string|null */
        public ?string $Type=null,
        /** @var string|null */
        public ?string $Title=null,
        /** @var string|null */
        public ?string $Status=null,
        /** @var string|null */
        public ?string $TemplateUID=null,
        /** @var int|null */
        public ?int $TemplateVersionNo=null,
        /** @var DateTime|null */
        public ?DateTime $ScheduledFor=null,
        /** @var DateTime|null */
        public ?DateTime $StartedAt=null,
        /** @var DateTime|null */
        public ?DateTime $CompletedAt=null,
        /** @var DateTime|null */
        public ?DateTime $ClosedAt=null,
        /** @var int|null */
        public ?int $InspectorContactID=null,
        /** @var string|null */
        public ?string $InspectorName=null,
        /** @var string|null */
        public ?string $AgencyName=null,
        /** @var string|null */
        public ?string $PermitNo=null,
        /** @var string|null */
        public ?string $LocationText=null,
        /** @var string|null */
        public ?string $Notes=null,
        /** @var string|null */
        public ?string $WeatherJson=null,
        /** @var int */
        public int $ItemsTotal=0,
        /** @var int */
        public int $ItemsPassed=0,
        /** @var int */
        public int $ItemsFailed=0,
        /** @var string|null */
        public ?string $Outcome=null,
        /** @var string|null */
        public ?string $OutcomeNotes=null,
        /** @var int|null */
        public ?int $ReinspectionOfInspectionID=null,
        /** @var int|null */
        public ?int $QcHoldPointID=null,
        /** @var string|null */
        public ?string $ReportAttachmentId=null,
        /** @var int */
        public int $RequestCount=0,
        /** @var int */
        public int $SignatureCount=0,
        /** @var string|null */
        public ?string $CreatedBy=null,
        /** @var DateTime|null */
        public ?DateTime $CreatedAt=null,
        /** @var DateTime|null */
        public ?DateTime $UpdatedAt=null,
        /** @var array<InspectionItem>|null */
        public ?array $Items=null,
        /** @var array<InspectionRequest>|null */
        public ?array $Requests=null,
        /** @var array<SignatureRecord>|null */
        public ?array $Signatures=null,
        /** @var array<string>|null */
        public ?array $Actions=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['InspectionID'])) $this->InspectionID = $o['InspectionID'];
        if (isset($o['InspectionUID'])) $this->InspectionUID = $o['InspectionUID'];
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        if (isset($o['ProjectName'])) $this->ProjectName = $o['ProjectName'];
        if (isset($o['JobID'])) $this->JobID = $o['JobID'];
        if (isset($o['JobName'])) $this->JobName = $o['JobName'];
        if (isset($o['InspectionNo'])) $this->InspectionNo = $o['InspectionNo'];
        if (isset($o['Type'])) $this->Type = $o['Type'];
        if (isset($o['Title'])) $this->Title = $o['Title'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['TemplateUID'])) $this->TemplateUID = $o['TemplateUID'];
        if (isset($o['TemplateVersionNo'])) $this->TemplateVersionNo = $o['TemplateVersionNo'];
        if (isset($o['ScheduledFor'])) $this->ScheduledFor = JsonConverters::from('DateTime', $o['ScheduledFor']);
        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['ClosedAt'])) $this->ClosedAt = JsonConverters::from('DateTime', $o['ClosedAt']);
        if (isset($o['InspectorContactID'])) $this->InspectorContactID = $o['InspectorContactID'];
        if (isset($o['InspectorName'])) $this->InspectorName = $o['InspectorName'];
        if (isset($o['AgencyName'])) $this->AgencyName = $o['AgencyName'];
        if (isset($o['PermitNo'])) $this->PermitNo = $o['PermitNo'];
        if (isset($o['LocationText'])) $this->LocationText = $o['LocationText'];
        if (isset($o['Notes'])) $this->Notes = $o['Notes'];
        if (isset($o['WeatherJson'])) $this->WeatherJson = $o['WeatherJson'];
        if (isset($o['ItemsTotal'])) $this->ItemsTotal = $o['ItemsTotal'];
        if (isset($o['ItemsPassed'])) $this->ItemsPassed = $o['ItemsPassed'];
        if (isset($o['ItemsFailed'])) $this->ItemsFailed = $o['ItemsFailed'];
        if (isset($o['Outcome'])) $this->Outcome = $o['Outcome'];
        if (isset($o['OutcomeNotes'])) $this->OutcomeNotes = $o['OutcomeNotes'];
        if (isset($o['ReinspectionOfInspectionID'])) $this->ReinspectionOfInspectionID = $o['ReinspectionOfInspectionID'];
        if (isset($o['QcHoldPointID'])) $this->QcHoldPointID = $o['QcHoldPointID'];
        if (isset($o['ReportAttachmentId'])) $this->ReportAttachmentId = $o['ReportAttachmentId'];
        if (isset($o['RequestCount'])) $this->RequestCount = $o['RequestCount'];
        if (isset($o['SignatureCount'])) $this->SignatureCount = $o['SignatureCount'];
        if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
        if (isset($o['CreatedAt'])) $this->CreatedAt = JsonConverters::from('DateTime', $o['CreatedAt']);
        if (isset($o['UpdatedAt'])) $this->UpdatedAt = JsonConverters::from('DateTime', $o['UpdatedAt']);
        if (isset($o['Items'])) $this->Items = JsonConverters::fromArray('InspectionItem', $o['Items']);
        if (isset($o['Requests'])) $this->Requests = JsonConverters::fromArray('InspectionRequest', $o['Requests']);
        if (isset($o['Signatures'])) $this->Signatures = JsonConverters::fromArray('SignatureRecord', $o['Signatures']);
        if (isset($o['Actions'])) $this->Actions = JsonConverters::fromArray('string', $o['Actions']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->InspectionID)) $o['InspectionID'] = $this->InspectionID;
        if (isset($this->InspectionUID)) $o['InspectionUID'] = $this->InspectionUID;
        if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        if (isset($this->ProjectName)) $o['ProjectName'] = $this->ProjectName;
        if (isset($this->JobID)) $o['JobID'] = $this->JobID;
        if (isset($this->JobName)) $o['JobName'] = $this->JobName;
        if (isset($this->InspectionNo)) $o['InspectionNo'] = $this->InspectionNo;
        if (isset($this->Type)) $o['Type'] = $this->Type;
        if (isset($this->Title)) $o['Title'] = $this->Title;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->TemplateUID)) $o['TemplateUID'] = $this->TemplateUID;
        if (isset($this->TemplateVersionNo)) $o['TemplateVersionNo'] = $this->TemplateVersionNo;
        if (isset($this->ScheduledFor)) $o['ScheduledFor'] = JsonConverters::to('DateTime', $this->ScheduledFor);
        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->ClosedAt)) $o['ClosedAt'] = JsonConverters::to('DateTime', $this->ClosedAt);
        if (isset($this->InspectorContactID)) $o['InspectorContactID'] = $this->InspectorContactID;
        if (isset($this->InspectorName)) $o['InspectorName'] = $this->InspectorName;
        if (isset($this->AgencyName)) $o['AgencyName'] = $this->AgencyName;
        if (isset($this->PermitNo)) $o['PermitNo'] = $this->PermitNo;
        if (isset($this->LocationText)) $o['LocationText'] = $this->LocationText;
        if (isset($this->Notes)) $o['Notes'] = $this->Notes;
        if (isset($this->WeatherJson)) $o['WeatherJson'] = $this->WeatherJson;
        if (isset($this->ItemsTotal)) $o['ItemsTotal'] = $this->ItemsTotal;
        if (isset($this->ItemsPassed)) $o['ItemsPassed'] = $this->ItemsPassed;
        if (isset($this->ItemsFailed)) $o['ItemsFailed'] = $this->ItemsFailed;
        if (isset($this->Outcome)) $o['Outcome'] = $this->Outcome;
        if (isset($this->OutcomeNotes)) $o['OutcomeNotes'] = $this->OutcomeNotes;
        if (isset($this->ReinspectionOfInspectionID)) $o['ReinspectionOfInspectionID'] = $this->ReinspectionOfInspectionID;
        if (isset($this->QcHoldPointID)) $o['QcHoldPointID'] = $this->QcHoldPointID;
        if (isset($this->ReportAttachmentId)) $o['ReportAttachmentId'] = $this->ReportAttachmentId;
        if (isset($this->RequestCount)) $o['RequestCount'] = $this->RequestCount;
        if (isset($this->SignatureCount)) $o['SignatureCount'] = $this->SignatureCount;
        if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
        if (isset($this->CreatedAt)) $o['CreatedAt'] = JsonConverters::to('DateTime', $this->CreatedAt);
        if (isset($this->UpdatedAt)) $o['UpdatedAt'] = JsonConverters::to('DateTime', $this->UpdatedAt);
        if (isset($this->Items)) $o['Items'] = JsonConverters::toArray('InspectionItem', $this->Items);
        if (isset($this->Requests)) $o['Requests'] = JsonConverters::toArray('InspectionRequest', $this->Requests);
        if (isset($this->Signatures)) $o['Signatures'] = JsonConverters::toArray('SignatureRecord', $this->Signatures);
        if (isset($this->Actions)) $o['Actions'] = JsonConverters::toArray('string', $this->Actions);
        return empty($o) ? new class(){} : $o;
    }
}

class InspectionReportSection implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Title=null,
        /** @var array<InspectionItem>|null */
        public ?array $Items=null,
        /** @var int */
        public int $Passed=0,
        /** @var int */
        public int $Failed=0
    ) {
    }

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

class InspectionReportResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var Inspection|null */
        public ?Inspection $Inspection=null,
        /** @var string|null */
        public ?string $CompanyName=null,
        /** @var string|null */
        public ?string $ProjectName=null,
        /** @var string|null */
        public ?string $ProjectAddress=null,
        /** @var string|null */
        public ?string $ClientName=null,
        /** @var array<InspectionReportSection>|null */
        public ?array $Sections=null,
        /** @var array<SignatureRecord>|null */
        public ?array $Signatures=null,
        /** @var string|null */
        public ?string $SnapshotHash=null,
        /** @var DateTime */
        public DateTime $GeneratedAt=new DateTime()
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
        if (isset($o['Inspection'])) $this->Inspection = JsonConverters::from('Inspection', $o['Inspection']);
        if (isset($o['CompanyName'])) $this->CompanyName = $o['CompanyName'];
        if (isset($o['ProjectName'])) $this->ProjectName = $o['ProjectName'];
        if (isset($o['ProjectAddress'])) $this->ProjectAddress = $o['ProjectAddress'];
        if (isset($o['ClientName'])) $this->ClientName = $o['ClientName'];
        if (isset($o['Sections'])) $this->Sections = JsonConverters::fromArray('InspectionReportSection', $o['Sections']);
        if (isset($o['Signatures'])) $this->Signatures = JsonConverters::fromArray('SignatureRecord', $o['Signatures']);
        if (isset($o['SnapshotHash'])) $this->SnapshotHash = $o['SnapshotHash'];
        if (isset($o['GeneratedAt'])) $this->GeneratedAt = JsonConverters::from('DateTime', $o['GeneratedAt']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        if (isset($this->Inspection)) $o['Inspection'] = JsonConverters::to('Inspection', $this->Inspection);
        if (isset($this->CompanyName)) $o['CompanyName'] = $this->CompanyName;
        if (isset($this->ProjectName)) $o['ProjectName'] = $this->ProjectName;
        if (isset($this->ProjectAddress)) $o['ProjectAddress'] = $this->ProjectAddress;
        if (isset($this->ClientName)) $o['ClientName'] = $this->ClientName;
        if (isset($this->Sections)) $o['Sections'] = JsonConverters::toArray('InspectionReportSection', $this->Sections);
        if (isset($this->Signatures)) $o['Signatures'] = JsonConverters::toArray('SignatureRecord', $this->Signatures);
        if (isset($this->SnapshotHash)) $o['SnapshotHash'] = $this->SnapshotHash;
        if (isset($this->GeneratedAt)) $o['GeneratedAt'] = JsonConverters::to('DateTime', $this->GeneratedAt);
        return empty($o) ? new class(){} : $o;
    }
}

class InspectionReportRequest implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $InspectionUID=''
    ) {
    }

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

PHP InspectionReportRequest DTOs

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

HTTP + CSV

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

GET /v1/inspections/{InspectionUID}/report HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"Inspection":{"InspectionID":0,"InspectionUID":"00000000000000000000000000000000","ProjectID":0,"ProjectName":"String","JobID":0,"JobName":"String","InspectionNo":"String","Type":"String","Title":"String","Status":"String","TemplateUID":"00000000000000000000000000000000","TemplateVersionNo":0,"ScheduledFor":"0001-01-01T00:00:00.0000000","StartedAt":"0001-01-01T00:00:00.0000000","CompletedAt":"0001-01-01T00:00:00.0000000","ClosedAt":"0001-01-01T00:00:00.0000000","InspectorContactID":0,"InspectorName":"String","AgencyName":"String","PermitNo":"String","LocationText":"String","Notes":"String","WeatherJson":"String","ItemsTotal":0,"ItemsPassed":0,"ItemsFailed":0,"Outcome":"String","OutcomeNotes":"String","ReinspectionOfInspectionID":0,"QcHoldPointID":0,"ReportAttachmentId":"00000000000000000000000000000000","RequestCount":0,"SignatureCount":0,"CreatedBy":"String","CreatedAt":"0001-01-01T00:00:00.0000000","UpdatedAt":"0001-01-01T00:00:00.0000000","Items":[{"InspectionItemID":0,"InspectionID":0,"Seq":0,"Section":"String","Prompt":"String","ResponseType":"String","IsRequired":false,"Unit":"String","Guidance":"String","Result":"String","Value":"String","Notes":"String","PhotoCount":0,"LinkedPunchItemID":0,"LinkedPunchNo":"String","LinkedPunchStatus":"String","LinkedNcrID":0,"LinkedNcrNo":"String","LinkedActionID":0,"AnsweredBy":"String","AnsweredAt":"0001-01-01T00:00:00.0000000","Photos":[{"AttachmentId":"00000000000000000000000000000000","FileName":"String","Url":"String","CreatedBy":"String","CreatedDate":"0001-01-01T00:00:00.0000000","HasAnnotation":false,"AnnotatedAttachmentId":"00000000000000000000000000000000","AnnotatedUrl":"String"}]}],"Requests":[{"InspectionRequestID":0,"InspectionID":0,"Agency":"String","ContactName":"String","ContactPhone":"String","PermitNo":"String","RequestedDate":"0001-01-01T00:00:00.0000000","RequestedWindow":"String","Status":"String","ConfirmationNo":"String","Outcome":"String","CreatedBy":"String","CreatedAt":"0001-01-01T00:00:00.0000000","UpdatedAt":"0001-01-01T00:00:00.0000000"}],"Signatures":[{"SignatureRecordID":0,"EntityType":"String","EntityID":0,"Role":"String","SignerName":"String","SignerContactID":0,"SignerUserId":"String","Method":"String","ImageAttachmentId":"00000000000000000000000000000000","ImageUrl":"String","ImageHash":"String","DocumentHash":"String","ConsentText":"String","IpAddress":"String","UserAgent":"String","SignedAt":"0001-01-01T00:00:00.0000000"}],"Actions":["String"]},"CompanyName":"String","ProjectName":"String","ProjectAddress":"String","ClientName":"String","Sections":[{"Title":"String","Items":[{"InspectionItemID":0,"InspectionID":0,"Seq":0,"Section":"String","Prompt":"String","ResponseType":"String","IsRequired":false,"Unit":"String","Guidance":"String","Result":"String","Value":"String","Notes":"String","PhotoCount":0,"LinkedPunchItemID":0,"LinkedPunchNo":"String","LinkedPunchStatus":"String","LinkedNcrID":0,"LinkedNcrNo":"String","LinkedActionID":0,"AnsweredBy":"String","AnsweredAt":"0001-01-01T00:00:00.0000000","Photos":[{"AttachmentId":"00000000000000000000000000000000","FileName":"String","Url":"String","CreatedBy":"String","CreatedDate":"0001-01-01T00:00:00.0000000","HasAnnotation":false,"AnnotatedAttachmentId":"00000000000000000000000000000000","AnnotatedUrl":"String"}]}],"Passed":0,"Failed":0}],"Signatures":[{"SignatureRecordID":0,"EntityType":"String","EntityID":0,"Role":"String","SignerName":"String","SignerContactID":0,"SignerUserId":"String","Method":"String","ImageAttachmentId":"00000000000000000000000000000000","ImageUrl":"String","ImageHash":"String","DocumentHash":"String","ConsentText":"String","IpAddress":"String","UserAgent":"String","SignedAt":"0001-01-01T00:00:00.0000000"}],"SnapshotHash":"String","GeneratedAt":"0001-01-01T00:00:00.0000000"}