Nephila RiskStore

<back to all web services

FindAnalysisRequest

General
Requires Authentication
Requires any of the roles:Riskstore.Write, Riskstore.Admin
The following routes are available for this service:
GET/api/riskstore/analysisSearch for analyses
<?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};


// @DataContract
class QueryBase implements JsonSerializable
{
    public function __construct(
        // @DataMember(Order=1)
        /** @var int|null */
        public ?int $skip=null,

        // @DataMember(Order=2)
        /** @var int|null */
        public ?int $take=null,

        // @DataMember(Order=3)
        /** @var string|null */
        public ?string $orderBy=null,

        // @DataMember(Order=4)
        /** @var string|null */
        public ?string $orderByDesc=null,

        // @DataMember(Order=5)
        /** @var string|null */
        public ?string $include=null,

        // @DataMember(Order=6)
        /** @var string|null */
        public ?string $fields=null,

        // @DataMember(Order=7)
        /** @var array<string,string>|null */
        public ?array $meta=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['skip'])) $this->skip = $o['skip'];
        if (isset($o['take'])) $this->take = $o['take'];
        if (isset($o['orderBy'])) $this->orderBy = $o['orderBy'];
        if (isset($o['orderByDesc'])) $this->orderByDesc = $o['orderByDesc'];
        if (isset($o['include'])) $this->include = $o['include'];
        if (isset($o['fields'])) $this->fields = $o['fields'];
        if (isset($o['meta'])) $this->meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['meta']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->skip)) $o['skip'] = $this->skip;
        if (isset($this->take)) $o['take'] = $this->take;
        if (isset($this->orderBy)) $o['orderBy'] = $this->orderBy;
        if (isset($this->orderByDesc)) $o['orderByDesc'] = $this->orderByDesc;
        if (isset($this->include)) $o['include'] = $this->include;
        if (isset($this->fields)) $o['fields'] = $this->fields;
        if (isset($this->meta)) $o['meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->meta);
        return empty($o) ? new class(){} : $o;
    }
}

/**
 * @template T
 */
class QueryDb extends QueryBase implements JsonSerializable
{
    public array $genericArgs = [];
    public static function create(array $genericArgs=[]): QueryDb {
        $to = new QueryDb();
        $to->genericArgs = $genericArgs;
        return $to;
    }

    /**
     * @param int|null $skip
     * @param int|null $take
     * @param string|null $orderBy
     * @param string|null $orderByDesc
     * @param string|null $include
     * @param string|null $fields
     * @param array<string,string>|null $meta
     */
    public function __construct(
        mixed $skip=null,
        mixed $take=null,
        mixed $orderBy=null,
        mixed $orderByDesc=null,
        mixed $include=null,
        mixed $fields=null,
        mixed $meta=null
    ) {
        parent::__construct($skip,$take,$orderBy,$orderByDesc,$include,$fields,$meta);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        return empty($o) ? new class(){} : $o;
    }
}

enum ResultOutputLevel : string
{
    case NotSet = 'NotSet';
    case PortfolioMetrics = 'PortfolioMetrics';
    case Curve = 'Curve';
    case YLT = 'YLT';
    case TailIntensity = 'TailIntensity';
    case DealYlt = 'DealYlt';
    case DealElt = 'DealElt';
    case DealEltWithIndustryLoss = 'DealEltWithIndustryLoss';
    case PortfolioElt = 'PortfolioElt';
    case PortfolioEltWithIndustryLoss = 'PortfolioEltWithIndustryLoss';
    case EventSetGeneration = 'EventSetGeneration';
    case PortfolioRaps = 'PortfolioRaps';
    case DealRaps = 'DealRaps';
    case PortfolioSepyIndustryLoss = 'PortfolioSepyIndustryLoss';
    case DealSepyIndustryLoss = 'DealSepyIndustryLoss';
}

enum ProcessingStatus : int
{
    case New = 0;
    case Processing = 1;
    case Failed = 10;
    case Successful = 20;
}

class AnalysisPortfolioEventSetConfiguration implements IObjectWithId, IHasAnalysisId, JsonSerializable
{
    public function __construct(
        // @DataMember(Order=1)
        /** @var int */
        public int $id=0,

        // @DataMember(Order=2)
        /** @var int */
        public int $analysisId=0,

        // @DataMember(Order=3)
        /** @var int */
        public int $analysisConfigurationId=0,

        // @DataMember(Order=4)
        /** @var string|null */
        public ?string $portfolioName=null,

        // @DataMember(Order=5)
        /** @var string|null */
        public ?string $modelId=null,

        // @DataMember(Order=6)
        /** @var string */
        public string $rowIdentifier=''
    ) {
    }

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

// @DataContract
class AnalysisConfiguration implements IObjectWithId, IHasAnalysisId, JsonSerializable
{
    public function __construct(
        // @DataMember(Order=1)
        /** @var int */
        public int $id=0,

        // @DataMember(Order=2)
        /** @var int */
        public int $analysisId=0,

        // @DataMember(Order=3)
        /** @var DateTime|null */
        public ?DateTime $windowStartDate=null,

        // @DataMember(Order=4)
        /** @var DateTime|null */
        public ?DateTime $windowEndDate=null,

        // @DataMember(Order=5)
        /** @var bool|null */
        public ?bool $standardEnabled=null,

        // @DataMember(Order=6)
        /** @var bool|null */
        public ?bool $runOffEnabled=null,

        // @DataMember(Order=7)
        /** @var bool|null */
        public ?bool $aggregateEnabled=null,

        // @DataMember(Order=8)
        /** @var bool|null */
        public ?bool $occurrenceEnabled=null,

        // @DataMember(Order=9)
        /** @var bool|null */
        public ?bool $nettEnabled=null,

        // @DataMember(Order=10)
        /** @var bool|null */
        public ?bool $grossEnabled=null,

        // @DataMember(Order=11)
        /** @var float|null */
        public ?float $tailIntensityPercentageStart=null,

        // @DataMember(Order=12)
        /** @var float|null */
        public ?float $tailIntensityPercentageEnd=null,

        // @DataMember(Order=13)
        /** @var int */
        public int $metaRiskId=0,

        // @DataMember(Order=14)
        /** @var ResultOutputLevel|null */
        public ?ResultOutputLevel $outputLevel=null,

        // @DataMember(Order=15)
        /** @var ProcessingStatus|null */
        public ?ProcessingStatus $processingStatus=null,

        // @DataMember(Order=16)
        /** @var float|null */
        public ?float $eventLossFloorStartRange=null,

        // @DataMember(Order=17)
        /** @var float|null */
        public ?float $eventLossFloorEndRange=null,

        // @DataMember(Order=18)
        /** @var array<AnalysisPortfolioEventSetConfiguration>|null */
        public ?array $analysisPortfolioEventSetConfigurations=null,

        // @DataMember(Order=19)
        /** @var string */
        public string $rowIdentifier=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['analysisId'])) $this->analysisId = $o['analysisId'];
        if (isset($o['windowStartDate'])) $this->windowStartDate = JsonConverters::from('DateTime', $o['windowStartDate']);
        if (isset($o['windowEndDate'])) $this->windowEndDate = JsonConverters::from('DateTime', $o['windowEndDate']);
        if (isset($o['standardEnabled'])) $this->standardEnabled = $o['standardEnabled'];
        if (isset($o['runOffEnabled'])) $this->runOffEnabled = $o['runOffEnabled'];
        if (isset($o['aggregateEnabled'])) $this->aggregateEnabled = $o['aggregateEnabled'];
        if (isset($o['occurrenceEnabled'])) $this->occurrenceEnabled = $o['occurrenceEnabled'];
        if (isset($o['nettEnabled'])) $this->nettEnabled = $o['nettEnabled'];
        if (isset($o['grossEnabled'])) $this->grossEnabled = $o['grossEnabled'];
        if (isset($o['tailIntensityPercentageStart'])) $this->tailIntensityPercentageStart = $o['tailIntensityPercentageStart'];
        if (isset($o['tailIntensityPercentageEnd'])) $this->tailIntensityPercentageEnd = $o['tailIntensityPercentageEnd'];
        if (isset($o['metaRiskId'])) $this->metaRiskId = $o['metaRiskId'];
        if (isset($o['outputLevel'])) $this->outputLevel = JsonConverters::from('ResultOutputLevel', $o['outputLevel']);
        if (isset($o['processingStatus'])) $this->processingStatus = JsonConverters::from('ProcessingStatus', $o['processingStatus']);
        if (isset($o['eventLossFloorStartRange'])) $this->eventLossFloorStartRange = $o['eventLossFloorStartRange'];
        if (isset($o['eventLossFloorEndRange'])) $this->eventLossFloorEndRange = $o['eventLossFloorEndRange'];
        if (isset($o['analysisPortfolioEventSetConfigurations'])) $this->analysisPortfolioEventSetConfigurations = JsonConverters::fromArray('AnalysisPortfolioEventSetConfiguration', $o['analysisPortfolioEventSetConfigurations']);
        if (isset($o['rowIdentifier'])) $this->rowIdentifier = $o['rowIdentifier'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->analysisId)) $o['analysisId'] = $this->analysisId;
        if (isset($this->windowStartDate)) $o['windowStartDate'] = JsonConverters::to('DateTime', $this->windowStartDate);
        if (isset($this->windowEndDate)) $o['windowEndDate'] = JsonConverters::to('DateTime', $this->windowEndDate);
        if (isset($this->standardEnabled)) $o['standardEnabled'] = $this->standardEnabled;
        if (isset($this->runOffEnabled)) $o['runOffEnabled'] = $this->runOffEnabled;
        if (isset($this->aggregateEnabled)) $o['aggregateEnabled'] = $this->aggregateEnabled;
        if (isset($this->occurrenceEnabled)) $o['occurrenceEnabled'] = $this->occurrenceEnabled;
        if (isset($this->nettEnabled)) $o['nettEnabled'] = $this->nettEnabled;
        if (isset($this->grossEnabled)) $o['grossEnabled'] = $this->grossEnabled;
        if (isset($this->tailIntensityPercentageStart)) $o['tailIntensityPercentageStart'] = $this->tailIntensityPercentageStart;
        if (isset($this->tailIntensityPercentageEnd)) $o['tailIntensityPercentageEnd'] = $this->tailIntensityPercentageEnd;
        if (isset($this->metaRiskId)) $o['metaRiskId'] = $this->metaRiskId;
        if (isset($this->outputLevel)) $o['outputLevel'] = JsonConverters::to('ResultOutputLevel', $this->outputLevel);
        if (isset($this->processingStatus)) $o['processingStatus'] = JsonConverters::to('ProcessingStatus', $this->processingStatus);
        if (isset($this->eventLossFloorStartRange)) $o['eventLossFloorStartRange'] = $this->eventLossFloorStartRange;
        if (isset($this->eventLossFloorEndRange)) $o['eventLossFloorEndRange'] = $this->eventLossFloorEndRange;
        if (isset($this->analysisPortfolioEventSetConfigurations)) $o['analysisPortfolioEventSetConfigurations'] = JsonConverters::toArray('AnalysisPortfolioEventSetConfiguration', $this->analysisPortfolioEventSetConfigurations);
        if (isset($this->rowIdentifier)) $o['rowIdentifier'] = $this->rowIdentifier;
        return empty($o) ? new class(){} : $o;
    }
}

enum TransactionType : string
{
    case NotSet = 'NotSet';
    case S = 'S';
    case B = 'B';
}

// @DataContract
class AnalysisPortfolioAllocation implements IObjectWithId, JsonSerializable
{
    public function __construct(
        // @DataMember(Order=1)
        /** @var int */
        public int $id=0,

        // @DataMember(Order=2)
        /** @var int */
        public int $analysisDealId=0,

        // @DataMember(Order=3)
        // @Validate(Validator="NotEmpty", Message="PortfolioName is mandatory")
        /** @var string */
        public string $portfolioName='',

        // @DataMember(Order=4)
        /** @var float */
        public float $allocationPercentage=0.0,

        // @DataMember(Order=5)
        /** @var string */
        public string $rowIdentifier=''
    ) {
    }

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

// @DataContract
class AnalysisDeal implements IObjectWithId, IHasAnalysisId, JsonSerializable
{
    public function __construct(
        // @DataMember(Order=1)
        /** @var int */
        public int $id=0,

        // @DataMember(Order=2)
        /** @var int */
        public int $analysisId=0,

        // @DataMember(Order=3)
        /** @var string|null */
        public ?string $sourceDealId=null,

        // @DataMember(Order=4)
        /** @var string|null */
        public ?string $dealRef=null,

        // @DataMember(Order=5)
        /** @var string|null */
        public ?string $sourceDealSystem=null,

        // @DataMember(Order=6)
        /** @var int */
        public int $eventSetId=0,

        // @DataMember(Order=7)
        /** @var float */
        public float $rol=0.0,

        // @DataMember(Order=8)
        /** @var float */
        public float $limit=0.0,

        // @DataMember(Order=9)
        /** @var DateTime */
        public DateTime $inceptionDate=new DateTime(),

        // @DataMember(Order=10)
        /** @var DateTime */
        public DateTime $expiryDate=new DateTime(),

        // @DataMember(Order=11)
        /** @var TransactionType|null */
        public ?TransactionType $transactionType=null,

        // @DataMember(Order=12)
        /** @var array<AnalysisPortfolioAllocation>|null */
        public ?array $allocations=null,

        // @DataMember(Order=13)
        /** @var int|null */
        public ?int $perspectiveIdOverride=null,

        // @DataMember(Order=14)
        /** @var int|null */
        public ?int $eventSetIdOverride=null,

        // @DataMember(Order=15)
        /** @var DateTime|null */
        public ?DateTime $modelAsOfDateOverride=null,

        // @DataMember(Order=16)
        /** @var string|null */
        public ?string $sourceModelSystemOverride=null,

        // @DataMember(Order=17)
        /** @var string|null */
        public ?string $sourceModelIdOverride=null,

        // @DataMember(Order=18)
        /** @var string|null */
        public ?string $sourceEventSetIdOverride=null,

        // @DataMember(Order=19)
        /** @var string|null */
        public ?string $eventSourceSystemOverride=null,

        // @DataMember(Order=20)
        /** @var string */
        public string $rowIdentifier=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['analysisId'])) $this->analysisId = $o['analysisId'];
        if (isset($o['sourceDealId'])) $this->sourceDealId = $o['sourceDealId'];
        if (isset($o['dealRef'])) $this->dealRef = $o['dealRef'];
        if (isset($o['sourceDealSystem'])) $this->sourceDealSystem = $o['sourceDealSystem'];
        if (isset($o['eventSetId'])) $this->eventSetId = $o['eventSetId'];
        if (isset($o['rol'])) $this->rol = $o['rol'];
        if (isset($o['limit'])) $this->limit = $o['limit'];
        if (isset($o['inceptionDate'])) $this->inceptionDate = JsonConverters::from('DateTime', $o['inceptionDate']);
        if (isset($o['expiryDate'])) $this->expiryDate = JsonConverters::from('DateTime', $o['expiryDate']);
        if (isset($o['transactionType'])) $this->transactionType = JsonConverters::from('TransactionType', $o['transactionType']);
        if (isset($o['allocations'])) $this->allocations = JsonConverters::fromArray('AnalysisPortfolioAllocation', $o['allocations']);
        if (isset($o['perspectiveIdOverride'])) $this->perspectiveIdOverride = $o['perspectiveIdOverride'];
        if (isset($o['eventSetIdOverride'])) $this->eventSetIdOverride = $o['eventSetIdOverride'];
        if (isset($o['modelAsOfDateOverride'])) $this->modelAsOfDateOverride = JsonConverters::from('DateTime', $o['modelAsOfDateOverride']);
        if (isset($o['sourceModelSystemOverride'])) $this->sourceModelSystemOverride = $o['sourceModelSystemOverride'];
        if (isset($o['sourceModelIdOverride'])) $this->sourceModelIdOverride = $o['sourceModelIdOverride'];
        if (isset($o['sourceEventSetIdOverride'])) $this->sourceEventSetIdOverride = $o['sourceEventSetIdOverride'];
        if (isset($o['eventSourceSystemOverride'])) $this->eventSourceSystemOverride = $o['eventSourceSystemOverride'];
        if (isset($o['rowIdentifier'])) $this->rowIdentifier = $o['rowIdentifier'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->analysisId)) $o['analysisId'] = $this->analysisId;
        if (isset($this->sourceDealId)) $o['sourceDealId'] = $this->sourceDealId;
        if (isset($this->dealRef)) $o['dealRef'] = $this->dealRef;
        if (isset($this->sourceDealSystem)) $o['sourceDealSystem'] = $this->sourceDealSystem;
        if (isset($this->eventSetId)) $o['eventSetId'] = $this->eventSetId;
        if (isset($this->rol)) $o['rol'] = $this->rol;
        if (isset($this->limit)) $o['limit'] = $this->limit;
        if (isset($this->inceptionDate)) $o['inceptionDate'] = JsonConverters::to('DateTime', $this->inceptionDate);
        if (isset($this->expiryDate)) $o['expiryDate'] = JsonConverters::to('DateTime', $this->expiryDate);
        if (isset($this->transactionType)) $o['transactionType'] = JsonConverters::to('TransactionType', $this->transactionType);
        if (isset($this->allocations)) $o['allocations'] = JsonConverters::toArray('AnalysisPortfolioAllocation', $this->allocations);
        if (isset($this->perspectiveIdOverride)) $o['perspectiveIdOverride'] = $this->perspectiveIdOverride;
        if (isset($this->eventSetIdOverride)) $o['eventSetIdOverride'] = $this->eventSetIdOverride;
        if (isset($this->modelAsOfDateOverride)) $o['modelAsOfDateOverride'] = JsonConverters::to('DateTime', $this->modelAsOfDateOverride);
        if (isset($this->sourceModelSystemOverride)) $o['sourceModelSystemOverride'] = $this->sourceModelSystemOverride;
        if (isset($this->sourceModelIdOverride)) $o['sourceModelIdOverride'] = $this->sourceModelIdOverride;
        if (isset($this->sourceEventSetIdOverride)) $o['sourceEventSetIdOverride'] = $this->sourceEventSetIdOverride;
        if (isset($this->eventSourceSystemOverride)) $o['eventSourceSystemOverride'] = $this->eventSourceSystemOverride;
        if (isset($this->rowIdentifier)) $o['rowIdentifier'] = $this->rowIdentifier;
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class AnalysisEventIdFilter implements IObjectWithId, IHasAnalysisId, JsonSerializable
{
    public function __construct(
        // @DataMember(Order=1)
        /** @var int */
        public int $id=0,

        // @DataMember(Order=2)
        /** @var int */
        public int $analysisId=0,

        // @DataMember(Order=3)
        /** @var int */
        public int $eventSourceId=0,

        // @DataMember(Order=4)
        /** @var int */
        public int $eventId=0,

        // @DataMember(Order=5)
        /** @var string */
        public string $rowIdentifier=''
    ) {
    }

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

enum MessageType : string
{
    case NotSet = 'NotSet';
    case Persistence = 'Persistence';
    case Archival = 'Archival';
}

// @DataContract
class MessageTracking implements JsonSerializable
{
    public function __construct(
        // @DataMember(Order=1)
        /** @var string */
        public string $id='',

        // @DataMember(Order=2)
        /** @var int|null */
        public ?int $analysisId=null,

        // @DataMember(Order=3)
        /** @var ProcessingStatus|null */
        public ?ProcessingStatus $processingStatus=null,

        // @DataMember(Order=4)
        /** @var MessageType|null */
        public ?MessageType $messageType=null,

        // @DataMember(Order=5)
        /** @var DateTime */
        public DateTime $createdDateUtc=new DateTime(),

        // @DataMember(Order=6)
        /** @var DateTime */
        public DateTime $updatedDateUtc=new DateTime()
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['analysisId'])) $this->analysisId = $o['analysisId'];
        if (isset($o['processingStatus'])) $this->processingStatus = JsonConverters::from('ProcessingStatus', $o['processingStatus']);
        if (isset($o['messageType'])) $this->messageType = JsonConverters::from('MessageType', $o['messageType']);
        if (isset($o['createdDateUtc'])) $this->createdDateUtc = JsonConverters::from('DateTime', $o['createdDateUtc']);
        if (isset($o['updatedDateUtc'])) $this->updatedDateUtc = JsonConverters::from('DateTime', $o['updatedDateUtc']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->analysisId)) $o['analysisId'] = $this->analysisId;
        if (isset($this->processingStatus)) $o['processingStatus'] = JsonConverters::to('ProcessingStatus', $this->processingStatus);
        if (isset($this->messageType)) $o['messageType'] = JsonConverters::to('MessageType', $this->messageType);
        if (isset($this->createdDateUtc)) $o['createdDateUtc'] = JsonConverters::to('DateTime', $this->createdDateUtc);
        if (isset($this->updatedDateUtc)) $o['updatedDateUtc'] = JsonConverters::to('DateTime', $this->updatedDateUtc);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class Analysis implements IObjectWithId, JsonSerializable
{
    public function __construct(
        // @DataMember(Order=1)
        /** @var int */
        public int $id=0,

        // @DataMember(Order=2)
        /** @var string|null */
        public ?string $name=null,

        // @DataMember(Order=3)
        /** @var DateTime|null */
        public ?DateTime $modelAsOfDate=null,

        // @DataMember(Order=4)
        /** @var int */
        public int $perspectiveId=0,

        // @DataMember(Order=5)
        /** @var array<AnalysisConfiguration>|null */
        public ?array $configurations=null,

        // @DataMember(Order=6)
        /** @var array<AnalysisDeal>|null */
        public ?array $deals=null,

        // @DataMember(Order=7)
        /** @var array<AnalysisEventIdFilter>|null */
        public ?array $eventIdFilters=null,

        // @DataMember(Order=8)
        /** @var string|null */
        public ?string $createdBy=null,

        // @DataMember(Order=9)
        /** @var DateTime */
        public DateTime $createdDateUtc=new DateTime(),

        // @DataMember(Order=10)
        /** @var DateTime|null */
        public ?DateTime $completedDateUtc=null,

        // @DataMember(Order=11)
        /** @var int|null */
        public ?int $legacyAnalysisId=null,

        // @DataMember(Order=12)
        /** @var array<MessageTracking>|null */
        public ?array $resultPersistenceTracking=null,

        // @DataMember(Order=13)
        /** @var ProcessingStatus|null */
        public ?ProcessingStatus $processingStatus=null,

        // @DataMember(Order=14)
        /** @var bool|null */
        public ?bool $saveResults=null,

        // @DataMember(Order=15)
        /** @var string|null */
        public ?string $eventSourceSystem=null,

        // @DataMember(Order=16)
        /** @var DateTime */
        public DateTime $updatedDateUtc=new DateTime(),

        // @DataMember(Order=17)
        /** @var bool|null */
        public ?bool $isExpired=null,

        // @DataMember(Order=18)
        /** @var string */
        public string $rowIdentifier='',

        // @DataMember(Order=19)
        /** @var string|null */
        public ?string $errorMessage=null,

        /** @description Take the minimum simulation count when we have different simulations between event sets */
        // @DataMember(Order=20)
        // @ApiMember(DataType="boolean", Description="Take the minimum simulation count when we have different simulations between event sets")
        /** @var bool|null */
        public ?bool $ignoreSimulationCountMismatch=null,

        // @DataMember(Order=21)
        // @Ignore()
        /** @var ProcessingStatus|null */
        public ?ProcessingStatus $finalStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['modelAsOfDate'])) $this->modelAsOfDate = JsonConverters::from('DateTime', $o['modelAsOfDate']);
        if (isset($o['perspectiveId'])) $this->perspectiveId = $o['perspectiveId'];
        if (isset($o['configurations'])) $this->configurations = JsonConverters::fromArray('AnalysisConfiguration', $o['configurations']);
        if (isset($o['deals'])) $this->deals = JsonConverters::fromArray('AnalysisDeal', $o['deals']);
        if (isset($o['eventIdFilters'])) $this->eventIdFilters = JsonConverters::fromArray('AnalysisEventIdFilter', $o['eventIdFilters']);
        if (isset($o['createdBy'])) $this->createdBy = $o['createdBy'];
        if (isset($o['createdDateUtc'])) $this->createdDateUtc = JsonConverters::from('DateTime', $o['createdDateUtc']);
        if (isset($o['completedDateUtc'])) $this->completedDateUtc = JsonConverters::from('DateTime', $o['completedDateUtc']);
        if (isset($o['legacyAnalysisId'])) $this->legacyAnalysisId = $o['legacyAnalysisId'];
        if (isset($o['resultPersistenceTracking'])) $this->resultPersistenceTracking = JsonConverters::fromArray('MessageTracking', $o['resultPersistenceTracking']);
        if (isset($o['processingStatus'])) $this->processingStatus = JsonConverters::from('ProcessingStatus', $o['processingStatus']);
        if (isset($o['saveResults'])) $this->saveResults = $o['saveResults'];
        if (isset($o['eventSourceSystem'])) $this->eventSourceSystem = $o['eventSourceSystem'];
        if (isset($o['updatedDateUtc'])) $this->updatedDateUtc = JsonConverters::from('DateTime', $o['updatedDateUtc']);
        if (isset($o['isExpired'])) $this->isExpired = $o['isExpired'];
        if (isset($o['rowIdentifier'])) $this->rowIdentifier = $o['rowIdentifier'];
        if (isset($o['errorMessage'])) $this->errorMessage = $o['errorMessage'];
        if (isset($o['ignoreSimulationCountMismatch'])) $this->ignoreSimulationCountMismatch = $o['ignoreSimulationCountMismatch'];
        if (isset($o['finalStatus'])) $this->finalStatus = JsonConverters::from('ProcessingStatus', $o['finalStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->modelAsOfDate)) $o['modelAsOfDate'] = JsonConverters::to('DateTime', $this->modelAsOfDate);
        if (isset($this->perspectiveId)) $o['perspectiveId'] = $this->perspectiveId;
        if (isset($this->configurations)) $o['configurations'] = JsonConverters::toArray('AnalysisConfiguration', $this->configurations);
        if (isset($this->deals)) $o['deals'] = JsonConverters::toArray('AnalysisDeal', $this->deals);
        if (isset($this->eventIdFilters)) $o['eventIdFilters'] = JsonConverters::toArray('AnalysisEventIdFilter', $this->eventIdFilters);
        if (isset($this->createdBy)) $o['createdBy'] = $this->createdBy;
        if (isset($this->createdDateUtc)) $o['createdDateUtc'] = JsonConverters::to('DateTime', $this->createdDateUtc);
        if (isset($this->completedDateUtc)) $o['completedDateUtc'] = JsonConverters::to('DateTime', $this->completedDateUtc);
        if (isset($this->legacyAnalysisId)) $o['legacyAnalysisId'] = $this->legacyAnalysisId;
        if (isset($this->resultPersistenceTracking)) $o['resultPersistenceTracking'] = JsonConverters::toArray('MessageTracking', $this->resultPersistenceTracking);
        if (isset($this->processingStatus)) $o['processingStatus'] = JsonConverters::to('ProcessingStatus', $this->processingStatus);
        if (isset($this->saveResults)) $o['saveResults'] = $this->saveResults;
        if (isset($this->eventSourceSystem)) $o['eventSourceSystem'] = $this->eventSourceSystem;
        if (isset($this->updatedDateUtc)) $o['updatedDateUtc'] = JsonConverters::to('DateTime', $this->updatedDateUtc);
        if (isset($this->isExpired)) $o['isExpired'] = $this->isExpired;
        if (isset($this->rowIdentifier)) $o['rowIdentifier'] = $this->rowIdentifier;
        if (isset($this->errorMessage)) $o['errorMessage'] = $this->errorMessage;
        if (isset($this->ignoreSimulationCountMismatch)) $o['ignoreSimulationCountMismatch'] = $this->ignoreSimulationCountMismatch;
        if (isset($this->finalStatus)) $o['finalStatus'] = JsonConverters::to('ProcessingStatus', $this->finalStatus);
        return empty($o) ? new class(){} : $o;
    }
}

/**
 * @template QueryDb of Analysis
 */
class FindAnalysisRequest extends QueryDb implements JsonSerializable
{
    /**
     * @param int|null $skip
     * @param int|null $take
     * @param string|null $orderBy
     * @param string|null $orderByDesc
     * @param string|null $include
     * @param string|null $fields
     * @param array<string,string>|null $meta
     */
    public function __construct(
        ?int $skip=null,
        ?int $take=null,
        ?string $orderBy=null,
        ?string $orderByDesc=null,
        ?string $include=null,
        ?string $fields=null,
        ?array $meta=null,
        /** @description The Ids of the Analyses */
        // @ApiMember(DataType="integer", Description="The Ids of the Analyses", Format="int64")
        /** @var int[]|null */
        public ?array $ids=null,

        /** @description The partial name of the analyses */
        // @ApiMember(DataType="string", Description="The partial name of the analyses")
        /** @var string|null */
        public ?string $name=null,

        /** @description Filter only Standard analysis type */
        // @ApiMember(DataType="boolean", Description="Filter only Standard analysis type")
        /** @var bool|null */
        public ?bool $standardEnabled=null,

        /** @description Filter only Run Off analysis type */
        // @ApiMember(DataType="boolean", Description="Filter only Run Off analysis type")
        /** @var bool|null */
        public ?bool $runOffEnabled=null,

        /** @description The perspective id used for the analysis */
        // @ApiMember(DataType="integer", Description="The perspective id used for the analysis", Format="int32")
        /** @var int|null */
        public ?int $perspectiveId=null,

        /** @description The partial name of the user who run the analysis */
        // @ApiMember(DataType="string", Description="The partial name of the user who run the analysis")
        /** @var string|null */
        public ?string $createdBy=null,

        /** @description The analysis run date to filter from */
        // @ApiMember(DataType="string", Description="The analysis run date to filter from", Format="date-time")
        /** @var DateTime|null */
        public ?DateTime $analysisRunFromDateTime=null,

        /** @description The analysis run date to filter to */
        // @ApiMember(DataType="string", Description="The analysis run date to filter to", Format="date-time")
        /** @var DateTime|null */
        public ?DateTime $analysisRunToDateTime=null,

        /** @description The status of the analysis. 1 = Processing, 10 = Failed, 20 = Successful */
        // @ApiMember(DataType="integer", Description="The status of the analysis. 1 = Processing, 10 = Failed, 20 = Successful", Format="int32")
        /** @var ProcessingStatus|null */
        public ?ProcessingStatus $processingStatus=null
    ) {
        parent::__construct($skip,$take,$orderBy,$orderByDesc,$include,$fields,$meta);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['ids'])) $this->ids = JsonConverters::fromArray('int', $o['ids']);
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['standardEnabled'])) $this->standardEnabled = $o['standardEnabled'];
        if (isset($o['runOffEnabled'])) $this->runOffEnabled = $o['runOffEnabled'];
        if (isset($o['perspectiveId'])) $this->perspectiveId = $o['perspectiveId'];
        if (isset($o['createdBy'])) $this->createdBy = $o['createdBy'];
        if (isset($o['analysisRunFromDateTime'])) $this->analysisRunFromDateTime = JsonConverters::from('DateTime', $o['analysisRunFromDateTime']);
        if (isset($o['analysisRunToDateTime'])) $this->analysisRunToDateTime = JsonConverters::from('DateTime', $o['analysisRunToDateTime']);
        if (isset($o['processingStatus'])) $this->processingStatus = JsonConverters::from('ProcessingStatus', $o['processingStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->ids)) $o['ids'] = JsonConverters::toArray('int', $this->ids);
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->standardEnabled)) $o['standardEnabled'] = $this->standardEnabled;
        if (isset($this->runOffEnabled)) $o['runOffEnabled'] = $this->runOffEnabled;
        if (isset($this->perspectiveId)) $o['perspectiveId'] = $this->perspectiveId;
        if (isset($this->createdBy)) $o['createdBy'] = $this->createdBy;
        if (isset($this->analysisRunFromDateTime)) $o['analysisRunFromDateTime'] = JsonConverters::to('DateTime', $this->analysisRunFromDateTime);
        if (isset($this->analysisRunToDateTime)) $o['analysisRunToDateTime'] = JsonConverters::to('DateTime', $this->analysisRunToDateTime);
        if (isset($this->processingStatus)) $o['processingStatus'] = JsonConverters::to('ProcessingStatus', $this->processingStatus);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
/**
 * @template T
 */
class QueryResponse implements JsonSerializable
{
    public array $genericArgs = [];
    public static function create(array $genericArgs=[]): QueryResponse {
        $to = new QueryResponse();
        $to->genericArgs = $genericArgs;
        return $to;
    }

    public function __construct(
        // @DataMember(Order=1)
        /** @var int */
        public mixed $offset=0,

        // @DataMember(Order=2)
        /** @var int */
        public mixed $total=0,

        // @DataMember(Order=3)
        /** @var array<Analysis>|null */
        public mixed $results=null,

        // @DataMember(Order=4)
        /** @var array<string,string>|null */
        public mixed $meta=null,

        // @DataMember(Order=5)
        /** @var ResponseStatus|null */
        public mixed $responseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['offset'])) $this->offset = $o['offset'];
        if (isset($o['total'])) $this->total = $o['total'];
        if (isset($o['results'])) $this->results = JsonConverters::fromArray('Analysis', $o['results']);
        if (isset($o['meta'])) $this->meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['meta']);
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->offset)) $o['offset'] = $this->offset;
        if (isset($this->total)) $o['total'] = $this->total;
        if (isset($this->results)) $o['results'] = JsonConverters::toArray('Analysis', $this->results);
        if (isset($this->meta)) $o['meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->meta);
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

PHP FindAnalysisRequest 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 /api/riskstore/analysis HTTP/1.1 
Host: riskstoreng-dev.nephila.com 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"offset":0,"total":0,"results":[{"id":0,"name":"String","modelAsOfDate":"0001-01-01T00:00:00.0000000Z","perspectiveId":0,"configurations":[{"id":0,"analysisId":0,"windowStartDate":"0001-01-01T00:00:00.0000000Z","windowEndDate":"0001-01-01T00:00:00.0000000Z","standardEnabled":false,"runOffEnabled":false,"aggregateEnabled":false,"occurrenceEnabled":false,"nettEnabled":false,"grossEnabled":false,"tailIntensityPercentageStart":0,"tailIntensityPercentageEnd":0,"metaRiskId":0,"outputLevel":"NotSet","processingStatus":"New","eventLossFloorStartRange":0,"eventLossFloorEndRange":0,"analysisPortfolioEventSetConfigurations":[{"id":0,"analysisId":0,"analysisConfigurationId":0,"portfolioName":"String","modelId":"String","rowIdentifier":"00000000000000000000000000000000"}],"rowIdentifier":"00000000000000000000000000000000"}],"deals":[{"id":0,"analysisId":0,"sourceDealId":"String","dealRef":"String","sourceDealSystem":"String","eventSetId":0,"rol":0,"limit":0,"inceptionDate":"0001-01-01T00:00:00.0000000Z","expiryDate":"0001-01-01T00:00:00.0000000Z","transactionType":"NotSet","allocations":[{"id":0,"analysisDealId":0,"portfolioName":"String","allocationPercentage":0,"rowIdentifier":"00000000000000000000000000000000"}],"perspectiveIdOverride":0,"eventSetIdOverride":0,"modelAsOfDateOverride":"0001-01-01T00:00:00.0000000Z","sourceModelSystemOverride":"String","sourceModelIdOverride":"String","sourceEventSetIdOverride":"String","eventSourceSystemOverride":"String","rowIdentifier":"00000000000000000000000000000000"}],"eventIdFilters":[{"id":0,"analysisId":0,"eventSourceId":0,"eventId":0,"rowIdentifier":"00000000000000000000000000000000"}],"createdBy":"String","createdDateUtc":"0001-01-01T00:00:00.0000000Z","completedDateUtc":"0001-01-01T00:00:00.0000000Z","legacyAnalysisId":0,"resultPersistenceTracking":[{"id":"00000000000000000000000000000000","analysisId":0,"processingStatus":"New","messageType":"NotSet","createdDateUtc":"0001-01-01T00:00:00.0000000Z","updatedDateUtc":"0001-01-01T00:00:00.0000000Z"}],"processingStatus":"New","saveResults":false,"eventSourceSystem":"String","updatedDateUtc":"0001-01-01T00:00:00.0000000Z","isExpired":false,"rowIdentifier":"00000000000000000000000000000000","errorMessage":"String","ignoreSimulationCountMismatch":false,"finalStatus":"New"}],"meta":{"String":"String"},"responseStatus":{"__type":"ServiceStack.ResponseStatus, ServiceStack.Interfaces","errorCode":"String","message":"String","stackTrace":"String","errors":[{"__type":"ServiceStack.ResponseError, ServiceStack.Interfaces","errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}