/// <summary> /// Initializes a new instance of the <see cref="Contract" /> class. /// </summary> /// <param name="competitorId">The Smarkets competitor model id.</param> /// <param name="contractType">contractType.</param> /// <param name="created">When was the contract created in the Smarkets exchange (required).</param> /// <param name="displayOrder">Smarkets will display the contracts sorted by these values, in descending order.</param> /// <param name="hidden">Hidden contracts aren't displayed in our website.</param> /// <param name="id">This ID uniquely identifies the contract (required).</param> /// <param name="info">info.</param> /// <param name="marketId">This ID uniquely identifies the market (required).</param> /// <param name="modified">The datetime of the last modification made by Smarkets to the<br> contract properties (required).</param> /// <param name="name">Name for the contract, as displayed in our website.<br> Examples can be team names, horse names or other winning outcomes for each market.<br> It should not be used to identify the contract.<br> The contract_type field should be used instead. (required).</param> /// <param name="outcomeTimestamp">If the contract has settled, this will have the settlement datetime, null otherwise (required).</param> /// <param name="reductionFactor">reductionFactor.</param> /// <param name="slug">Slug concisely represents the contract.<br> It should not be used to identify the contract.<br> The contract_type field should be used instead. (required).</param> /// <param name="stateOrOutcome"> state_or_outcome can have the following values: <ul> <li>new: The contract was just created and is still not available for betting <li>open: open for betting <li>live: open and trading live in-play <li>halted: Trading on this contract has halted <li>winner: settled as winner. <li>loser: settled as loser. <li>deadheat: settled as a deadheat - a tie with other contract. <li>reduced: withdrawn and a reduction factor was applied. <li>voided: no longer available for betting <li>unavailable: not currently available for betting </ul> (required).</param> public Contract(int?competitorId = default(int?), ContractsResponseContractType contractType = default(ContractsResponseContractType), DateTime?created = default(DateTime?), int?displayOrder = default(int?), bool?hidden = default(bool?), string id = default(string), ContractsResponseInfo info = default(ContractsResponseInfo), string marketId = default(string), DateTime?modified = default(DateTime?), string name = default(string), DateTime?outcomeTimestamp = default(DateTime?), string reductionFactor = default(string), string slug = default(string), StateOrOutcomeEnum stateOrOutcome = default(StateOrOutcomeEnum)) { // to ensure "created" is required (not null) if (created == null) { throw new InvalidDataException("created is a required property for Contract and cannot be null"); } else { this.Created = created; } // to ensure "id" is required (not null) if (id == null) { throw new InvalidDataException("id is a required property for Contract and cannot be null"); } else { this.Id = id; } // to ensure "marketId" is required (not null) if (marketId == null) { throw new InvalidDataException("marketId is a required property for Contract and cannot be null"); } else { this.MarketId = marketId; } // to ensure "modified" is required (not null) if (modified == null) { throw new InvalidDataException("modified is a required property for Contract and cannot be null"); } else { this.Modified = modified; } // to ensure "name" is required (not null) if (name == null) { throw new InvalidDataException("name is a required property for Contract and cannot be null"); } else { this.Name = name; } // to ensure "outcomeTimestamp" is required (not null) if (outcomeTimestamp == null) { this.OutcomeTimestamp = outcomeTimestamp; //throw new InvalidDataException("outcomeTimestamp is a required property for Contract and cannot be null"); } else { this.OutcomeTimestamp = outcomeTimestamp; } // to ensure "slug" is required (not null) if (slug == null) { throw new InvalidDataException("slug is a required property for Contract and cannot be null"); } else { this.Slug = slug; } // to ensure "stateOrOutcome" is required (not null) if (stateOrOutcome == null) { throw new InvalidDataException("stateOrOutcome is a required property for Contract and cannot be null"); } else { this.StateOrOutcome = stateOrOutcome; } this.CompetitorId = competitorId; this.ContractType = contractType; this.DisplayOrder = displayOrder; this.Hidden = hidden; this.Info = info; this.ReductionFactor = reductionFactor; }