industryAssemblyLines.jsonl
Schema
_key(required): integer
Range: 2 .. 186activityID(required): integer
Range: 1 .. 9baseCostMultiplier: number
Range: 0.729 .. 1baseMaterialMultiplier(required): number
Range: 1 .. 1baseTimeMultiplier(required): number
Range: 0.4 .. 1description: string-
detailsPerCategory: array of objectcategoryID(required): integer
Range: 2 .. 87costMultiplier: number
Range: 1 .. 1materialMultiplier(required): number
Range: 0.95 .. 1timeMultiplier(required): number
Range: 0.4 .. 1
-
detailsPerGroup: array of objectcostMultiplier: number
Range: 1 .. 1groupID(required): integer
Range: 12 .. 5120materialMultiplier(required): number
Range: 0.95 .. 1timeMultiplier(required): number
Range: 0.4 .. 1
-
detailsPerTypeList: array of objectmaterialMultiplier(required): number
Range: 0.94 .. 0.94timeMultiplier(required): number
Range: 0.3 .. 0.3
-
name(required): string
Code snippets
// <auto-generated />
//
// To parse this JSON data, add NuGet 'System.Text.Json' then do:
//
// using QuickType;
//
// var industryAssemblyLine = IndustryAssemblyLine.FromJson(jsonString);
#nullable enable
#pragma warning disable CS8618
#pragma warning disable CS8601
#pragma warning disable CS8602
#pragma warning disable CS8603
namespace QuickType
{
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Globalization;
public partial class IndustryAssemblyLine
{
[JsonPropertyName("_key")]
public long Key { get; set; }
[JsonPropertyName("activityID")]
public long ActivityId { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("baseCostMultiplier")]
[JsonConverter(typeof(PurpleMinMaxValueCheckConverter))]
public double? BaseCostMultiplier { get; set; }
[JsonPropertyName("baseMaterialMultiplier")]
[JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
public double BaseMaterialMultiplier { get; set; }
[JsonPropertyName("baseTimeMultiplier")]
[JsonConverter(typeof(TentacledMinMaxValueCheckConverter))]
public double BaseTimeMultiplier { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("description")]
[JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
public string? Description { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("detailsPerCategory")]
public DetailsPerCategory[]? DetailsPerCategory { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("detailsPerGroup")]
public DetailsPerGroup[]? DetailsPerGroup { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("detailsPerTypeList")]
public DetailsPerTypeList[]? DetailsPerTypeList { get; set; }
[JsonPropertyName("name")]
[JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))]
public string Name { get; set; }
}
public partial class DetailsPerCategory
{
[JsonPropertyName("categoryID")]
public long CategoryId { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("costMultiplier")]
[JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
public double? CostMultiplier { get; set; }
[JsonPropertyName("materialMultiplier")]
[JsonConverter(typeof(StickyMinMaxValueCheckConverter))]
public double MaterialMultiplier { get; set; }
[JsonPropertyName("timeMultiplier")]
[JsonConverter(typeof(TentacledMinMaxValueCheckConverter))]
public double TimeMultiplier { get; set; }
}
public partial class DetailsPerGroup
{
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("costMultiplier")]
[JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
public double? CostMultiplier { get; set; }
[JsonPropertyName("groupID")]
public long GroupId { get; set; }
[JsonPropertyName("materialMultiplier")]
[JsonConverter(typeof(StickyMinMaxValueCheckConverter))]
public double MaterialMultiplier { get; set; }
[JsonPropertyName("timeMultiplier")]
[JsonConverter(typeof(TentacledMinMaxValueCheckConverter))]
public double TimeMultiplier { get; set; }
}
public partial class DetailsPerTypeList
{
[JsonPropertyName("materialMultiplier")]
[JsonConverter(typeof(IndigoMinMaxValueCheckConverter))]
public double MaterialMultiplier { get; set; }
[JsonPropertyName("timeMultiplier")]
[JsonConverter(typeof(IndecentMinMaxValueCheckConverter))]
public double TimeMultiplier { get; set; }
}
public partial class IndustryAssemblyLine
{
public static IndustryAssemblyLine FromJson(string json) => JsonSerializer.Deserialize<IndustryAssemblyLine>(json, QuickType.Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this IndustryAssemblyLine self) => JsonSerializer.Serialize(self, QuickType.Converter.Settings);
}
internal static class Converter
{
public static readonly JsonSerializerOptions Settings = new(JsonSerializerDefaults.General)
{
Converters =
{
new DateOnlyConverter(),
new TimeOnlyConverter(),
IsoDateTimeOffsetConverter.Singleton
},
};
}
internal class PurpleMinMaxValueCheckConverter : JsonConverter<double>
{
public override bool CanConvert(Type t) => t == typeof(double);
public override double Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetDouble();
if (value >= 0.729 && value <= 1)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void Write(Utf8JsonWriter writer, double value, JsonSerializerOptions options)
{
if (value >= 0.729 && value <= 1)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly PurpleMinMaxValueCheckConverter Singleton = new PurpleMinMaxValueCheckConverter();
}
internal class FluffyMinMaxValueCheckConverter : JsonConverter<double>
{
public override bool CanConvert(Type t) => t == typeof(double);
public override double Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetDouble();
if (value >= 1 && value <= 1)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void Write(Utf8JsonWriter writer, double value, JsonSerializerOptions options)
{
if (value >= 1 && value <= 1)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly FluffyMinMaxValueCheckConverter Singleton = new FluffyMinMaxValueCheckConverter();
}
internal class TentacledMinMaxValueCheckConverter : JsonConverter<double>
{
public override bool CanConvert(Type t) => t == typeof(double);
public override double Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetDouble();
if (value >= 0.4 && value <= 1)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void Write(Utf8JsonWriter writer, double value, JsonSerializerOptions options)
{
if (value >= 0.4 && value <= 1)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly TentacledMinMaxValueCheckConverter Singleton = new TentacledMinMaxValueCheckConverter();
}
internal class PurpleMinMaxLengthCheckConverter : JsonConverter<string>
{
public override bool CanConvert(Type t) => t == typeof(string);
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
if (value.Length >= 7 && value.Length <= 201)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value.Length >= 7 && value.Length <= 201)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly PurpleMinMaxLengthCheckConverter Singleton = new PurpleMinMaxLengthCheckConverter();
}
internal class StickyMinMaxValueCheckConverter : JsonConverter<double>
{
public override bool CanConvert(Type t) => t == typeof(double);
public override double Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetDouble();
if (value >= 0.95 && value <= 1)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void Write(Utf8JsonWriter writer, double value, JsonSerializerOptions options)
{
if (value >= 0.95 && value <= 1)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly StickyMinMaxValueCheckConverter Singleton = new StickyMinMaxValueCheckConverter();
}
internal class IndigoMinMaxValueCheckConverter : JsonConverter<double>
{
public override bool CanConvert(Type t) => t == typeof(double);
public override double Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetDouble();
if (value >= 0.94 && value <= 0.94)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void Write(Utf8JsonWriter writer, double value, JsonSerializerOptions options)
{
if (value >= 0.94 && value <= 0.94)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly IndigoMinMaxValueCheckConverter Singleton = new IndigoMinMaxValueCheckConverter();
}
internal class IndecentMinMaxValueCheckConverter : JsonConverter<double>
{
public override bool CanConvert(Type t) => t == typeof(double);
public override double Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetDouble();
if (value >= 0.3 && value <= 0.3)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void Write(Utf8JsonWriter writer, double value, JsonSerializerOptions options)
{
if (value >= 0.3 && value <= 0.3)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly IndecentMinMaxValueCheckConverter Singleton = new IndecentMinMaxValueCheckConverter();
}
internal class FluffyMinMaxLengthCheckConverter : JsonConverter<string>
{
public override bool CanConvert(Type t) => t == typeof(string);
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
if (value.Length >= 8 && value.Length <= 37)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value.Length >= 8 && value.Length <= 37)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly FluffyMinMaxLengthCheckConverter Singleton = new FluffyMinMaxLengthCheckConverter();
}
public class DateOnlyConverter : JsonConverter<DateOnly>
{
private readonly string serializationFormat;
public DateOnlyConverter() : this(null) { }
public DateOnlyConverter(string? serializationFormat)
{
this.serializationFormat = serializationFormat ?? "yyyy-MM-dd";
}
public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
return DateOnly.Parse(value!);
}
public override void Write(Utf8JsonWriter writer, DateOnly value, JsonSerializerOptions options)
=> writer.WriteStringValue(value.ToString(serializationFormat));
}
public class TimeOnlyConverter : JsonConverter<TimeOnly>
{
private readonly string serializationFormat;
public TimeOnlyConverter() : this(null) { }
public TimeOnlyConverter(string? serializationFormat)
{
this.serializationFormat = serializationFormat ?? "HH:mm:ss.fff";
}
public override TimeOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
return TimeOnly.Parse(value!);
}
public override void Write(Utf8JsonWriter writer, TimeOnly value, JsonSerializerOptions options)
=> writer.WriteStringValue(value.ToString(serializationFormat));
}
internal class IsoDateTimeOffsetConverter : JsonConverter<DateTimeOffset>
{
public override bool CanConvert(Type t) => t == typeof(DateTimeOffset);
private const string DefaultDateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";
private DateTimeStyles _dateTimeStyles = DateTimeStyles.RoundtripKind;
private string? _dateTimeFormat;
private CultureInfo? _culture;
public DateTimeStyles DateTimeStyles
{
get => _dateTimeStyles;
set => _dateTimeStyles = value;
}
public string? DateTimeFormat
{
get => _dateTimeFormat ?? string.Empty;
set => _dateTimeFormat = (string.IsNullOrEmpty(value)) ? null : value;
}
public CultureInfo Culture
{
get => _culture ?? CultureInfo.CurrentCulture;
set => _culture = value;
}
public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options)
{
string text;
if ((_dateTimeStyles & DateTimeStyles.AdjustToUniversal) == DateTimeStyles.AdjustToUniversal
|| (_dateTimeStyles & DateTimeStyles.AssumeUniversal) == DateTimeStyles.AssumeUniversal)
{
value = value.ToUniversalTime();
}
text = value.ToString(_dateTimeFormat ?? DefaultDateTimeFormat, Culture);
writer.WriteStringValue(text);
}
public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string? dateText = reader.GetString();
if (string.IsNullOrEmpty(dateText) == false)
{
if (!string.IsNullOrEmpty(_dateTimeFormat))
{
return DateTimeOffset.ParseExact(dateText, _dateTimeFormat, Culture, _dateTimeStyles);
}
else
{
return DateTimeOffset.Parse(dateText, Culture, _dateTimeStyles);
}
}
else
{
return default(DateTimeOffset);
}
}
public static readonly IsoDateTimeOffsetConverter Singleton = new IsoDateTimeOffsetConverter();
}
}
#pragma warning restore CS8618
#pragma warning restore CS8601
#pragma warning restore CS8602
#pragma warning restore CS8603
// Code generated from JSON Schema using quicktype. DO NOT EDIT.
// To parse and unparse this JSON data, add this code to your project and do:
//
// industryAssemblyLine, err := UnmarshalIndustryAssemblyLine(bytes)
// bytes, err = industryAssemblyLine.Marshal()
package model
import "encoding/json"
func UnmarshalIndustryAssemblyLine(data []byte) (IndustryAssemblyLine, error) {
var r IndustryAssemblyLine
err := json.Unmarshal(data, &r)
return r, err
}
func (r *IndustryAssemblyLine) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type IndustryAssemblyLine struct {
Key int64 `json:"_key"`
ActivityID int64 `json:"activityID"`
BaseCostMultiplier *float64 `json:"baseCostMultiplier,omitempty"`
BaseMaterialMultiplier float64 `json:"baseMaterialMultiplier"`
BaseTimeMultiplier float64 `json:"baseTimeMultiplier"`
Description *string `json:"description,omitempty"`
DetailsPerCategory []DetailsPerCategory `json:"detailsPerCategory,omitempty"`
DetailsPerGroup []DetailsPerGroup `json:"detailsPerGroup,omitempty"`
DetailsPerTypeList []DetailsPerTypeList `json:"detailsPerTypeList,omitempty"`
Name string `json:"name"`
}
type DetailsPerCategory struct {
CategoryID int64 `json:"categoryID"`
CostMultiplier *float64 `json:"costMultiplier,omitempty"`
MaterialMultiplier float64 `json:"materialMultiplier"`
TimeMultiplier float64 `json:"timeMultiplier"`
}
type DetailsPerGroup struct {
CostMultiplier *float64 `json:"costMultiplier,omitempty"`
GroupID int64 `json:"groupID"`
MaterialMultiplier float64 `json:"materialMultiplier"`
TimeMultiplier float64 `json:"timeMultiplier"`
}
type DetailsPerTypeList struct {
MaterialMultiplier float64 `json:"materialMultiplier"`
TimeMultiplier float64 `json:"timeMultiplier"`
}
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"_key":{"type":"integer","minimum":2,"maximum":186},"activityID":{"type":"integer","minimum":1,"maximum":9},"baseCostMultiplier":{"type":"number","minimum":0.729,"maximum":1.0},"baseMaterialMultiplier":{"type":"number","minimum":1.0,"maximum":1.0},"baseTimeMultiplier":{"type":"number","minimum":0.4,"maximum":1.0},"description":{"type":"string","minLength":7,"maxLength":201},"detailsPerCategory":{"type":"array","items":{"type":"object","properties":{"categoryID":{"type":"integer","minimum":2,"maximum":87},"costMultiplier":{"type":"number","minimum":1.0,"maximum":1.0},"materialMultiplier":{"type":"number","minimum":0.95,"maximum":1.0},"timeMultiplier":{"type":"number","minimum":0.4,"maximum":1.0}},"required":["categoryID","materialMultiplier","timeMultiplier"]},"minItems":1,"maxItems":17},"detailsPerGroup":{"type":"array","items":{"type":"object","properties":{"costMultiplier":{"type":"number","minimum":1.0,"maximum":1.0},"groupID":{"type":"integer","minimum":12,"maximum":5120},"materialMultiplier":{"type":"number","minimum":0.95,"maximum":1.0},"timeMultiplier":{"type":"number","minimum":0.4,"maximum":1.0}},"required":["groupID","materialMultiplier","timeMultiplier"]},"minItems":1,"maxItems":42},"detailsPerTypeList":{"type":"array","items":{"type":"object","properties":{"materialMultiplier":{"type":"number","minimum":0.94,"maximum":0.94},"timeMultiplier":{"type":"number","minimum":0.3,"maximum":0.3}},"required":["materialMultiplier","timeMultiplier"]},"minItems":1,"maxItems":1},"name":{"type":"string","minLength":8,"maxLength":37}},"required":["_key","activityID","baseMaterialMultiplier","baseTimeMultiplier","name"]}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json = Json { allowStructuredMapKeys = true }
// val industryAssemblyLine = json.parse(IndustryAssemblyLine.serializer(), jsonString)
package model
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
@Serializable
data class IndustryAssemblyLine (
@SerialName("_key")
val key: Long,
@SerialName("activityID")
val activityId: Long,
val baseCostMultiplier: Double? = null,
val baseMaterialMultiplier: Double,
val baseTimeMultiplier: Double,
val description: String? = null,
val detailsPerCategory: List<DetailsPerCategory>? = null,
val detailsPerGroup: List<DetailsPerGroup>? = null,
val detailsPerTypeList: List<DetailsPerTypeList>? = null,
val name: String
)
@Serializable
data class DetailsPerCategory (
@SerialName("categoryID")
val categoryId: Long,
val costMultiplier: Double? = null,
val materialMultiplier: Double,
val timeMultiplier: Double
)
@Serializable
data class DetailsPerGroup (
val costMultiplier: Double? = null,
@SerialName("groupID")
val groupId: Long,
val materialMultiplier: Double,
val timeMultiplier: Double
)
@Serializable
data class DetailsPerTypeList (
val materialMultiplier: Double,
val timeMultiplier: Double
)
<?php
// This is an autogenerated file:IndustryAssemblyLine
class IndustryAssemblyLine {
private int $key; // json:_key Required
private int $activityId; // json:activityID Required
private ?float $baseCostMultiplier; // json:baseCostMultiplier Optional
private float $baseMaterialMultiplier; // json:baseMaterialMultiplier Required
private float $baseTimeMultiplier; // json:baseTimeMultiplier Required
private ?string $description; // json:description Optional
private ?array $detailsPerCategory; // json:detailsPerCategory Optional
private ?array $detailsPerGroup; // json:detailsPerGroup Optional
private ?array $detailsPerTypeList; // json:detailsPerTypeList Optional
private string $name; // json:name Required
/**
* @param int $key
* @param int $activityId
* @param float|null $baseCostMultiplier
* @param float $baseMaterialMultiplier
* @param float $baseTimeMultiplier
* @param string|null $description
* @param array|null $detailsPerCategory
* @param array|null $detailsPerGroup
* @param array|null $detailsPerTypeList
* @param string $name
*/
public function __construct(int $key, int $activityId, ?float $baseCostMultiplier, float $baseMaterialMultiplier, float $baseTimeMultiplier, ?string $description, ?array $detailsPerCategory, ?array $detailsPerGroup, ?array $detailsPerTypeList, string $name) {
$this->key = $key;
$this->activityId = $activityId;
$this->baseCostMultiplier = $baseCostMultiplier;
$this->baseMaterialMultiplier = $baseMaterialMultiplier;
$this->baseTimeMultiplier = $baseTimeMultiplier;
$this->description = $description;
$this->detailsPerCategory = $detailsPerCategory;
$this->detailsPerGroup = $detailsPerGroup;
$this->detailsPerTypeList = $detailsPerTypeList;
$this->name = $name;
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromKey(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toKey(): int {
if (IndustryAssemblyLine::validateKey($this->key)) {
return $this->key; /*int*/
}
throw new Exception('never get to this IndustryAssemblyLine::key');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateKey(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:IndustryAssemblyLine::key");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getKey(): int {
if (IndustryAssemblyLine::validateKey($this->key)) {
return $this->key;
}
throw new Exception('never get to getKey IndustryAssemblyLine::key');
}
/**
* @return int
*/
public static function sampleKey(): int {
return 31; /*31:key*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromActivityId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toActivityId(): int {
if (IndustryAssemblyLine::validateActivityId($this->activityId)) {
return $this->activityId; /*int*/
}
throw new Exception('never get to this IndustryAssemblyLine::activityId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateActivityId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:IndustryAssemblyLine::activityId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getActivityId(): int {
if (IndustryAssemblyLine::validateActivityId($this->activityId)) {
return $this->activityId;
}
throw new Exception('never get to getActivityId IndustryAssemblyLine::activityId');
}
/**
* @return int
*/
public static function sampleActivityId(): int {
return 32; /*32:activityId*/
}
/**
* @param ?float $value
* @throws Exception
* @return ?float
*/
public static function fromBaseCostMultiplier(?float $value): ?float {
if (!is_null($value)) {
return $value; /*float*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?float
*/
public function toBaseCostMultiplier(): ?float {
if (IndustryAssemblyLine::validateBaseCostMultiplier($this->baseCostMultiplier)) {
if (!is_null($this->baseCostMultiplier)) {
return $this->baseCostMultiplier; /*float*/
} else {
return null;
}
}
throw new Exception('never get to this IndustryAssemblyLine::baseCostMultiplier');
}
/**
* @param float|null
* @return bool
* @throws Exception
*/
public static function validateBaseCostMultiplier(?float $value): bool {
if (!is_null($value)) {
if (!is_float($value) && !is_int($value)) {
throw new Exception("Attribute Error:IndustryAssemblyLine::baseCostMultiplier");
}
}
return true;
}
/**
* @throws Exception
* @return ?float
*/
public function getBaseCostMultiplier(): ?float {
if (IndustryAssemblyLine::validateBaseCostMultiplier($this->baseCostMultiplier)) {
return $this->baseCostMultiplier;
}
throw new Exception('never get to getBaseCostMultiplier IndustryAssemblyLine::baseCostMultiplier');
}
/**
* @return ?float
*/
public static function sampleBaseCostMultiplier(): ?float {
return 33.033; /*33:baseCostMultiplier*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromBaseMaterialMultiplier(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toBaseMaterialMultiplier(): float {
if (IndustryAssemblyLine::validateBaseMaterialMultiplier($this->baseMaterialMultiplier)) {
return $this->baseMaterialMultiplier; /*float*/
}
throw new Exception('never get to this IndustryAssemblyLine::baseMaterialMultiplier');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateBaseMaterialMultiplier(float $value): bool {
if (!is_float($value) && !is_int($value)) {
throw new Exception("Attribute Error:IndustryAssemblyLine::baseMaterialMultiplier");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getBaseMaterialMultiplier(): float {
if (IndustryAssemblyLine::validateBaseMaterialMultiplier($this->baseMaterialMultiplier)) {
return $this->baseMaterialMultiplier;
}
throw new Exception('never get to getBaseMaterialMultiplier IndustryAssemblyLine::baseMaterialMultiplier');
}
/**
* @return float
*/
public static function sampleBaseMaterialMultiplier(): float {
return 34.034; /*34:baseMaterialMultiplier*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromBaseTimeMultiplier(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toBaseTimeMultiplier(): float {
if (IndustryAssemblyLine::validateBaseTimeMultiplier($this->baseTimeMultiplier)) {
return $this->baseTimeMultiplier; /*float*/
}
throw new Exception('never get to this IndustryAssemblyLine::baseTimeMultiplier');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateBaseTimeMultiplier(float $value): bool {
if (!is_float($value) && !is_int($value)) {
throw new Exception("Attribute Error:IndustryAssemblyLine::baseTimeMultiplier");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getBaseTimeMultiplier(): float {
if (IndustryAssemblyLine::validateBaseTimeMultiplier($this->baseTimeMultiplier)) {
return $this->baseTimeMultiplier;
}
throw new Exception('never get to getBaseTimeMultiplier IndustryAssemblyLine::baseTimeMultiplier');
}
/**
* @return float
*/
public static function sampleBaseTimeMultiplier(): float {
return 35.035; /*35:baseTimeMultiplier*/
}
/**
* @param ?string $value
* @throws Exception
* @return ?string
*/
public static function fromDescription(?string $value): ?string {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toDescription(): ?string {
if (IndustryAssemblyLine::validateDescription($this->description)) {
if (!is_null($this->description)) {
return $this->description; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this IndustryAssemblyLine::description');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateDescription(?string $value): bool {
if (!is_null($value)) {
if (!is_string($value)) {
throw new Exception("Attribute Error:IndustryAssemblyLine::description");
}
}
return true;
}
/**
* @throws Exception
* @return ?string
*/
public function getDescription(): ?string {
if (IndustryAssemblyLine::validateDescription($this->description)) {
return $this->description;
}
throw new Exception('never get to getDescription IndustryAssemblyLine::description');
}
/**
* @return ?string
*/
public static function sampleDescription(): ?string {
return 'IndustryAssemblyLine::description::36'; /*36:description*/
}
/**
* @param ?array $value
* @throws Exception
* @return ?array
*/
public static function fromDetailsPerCategory(?array $value): ?array {
if (!is_null($value)) {
return array_map(function ($value) {
return DetailsPerCategory::from($value); /*class*/
}, $value);
} else {
return null;
}
}
/**
* @throws Exception
* @return ?array
*/
public function toDetailsPerCategory(): ?array {
if (IndustryAssemblyLine::validateDetailsPerCategory($this->detailsPerCategory)) {
if (!is_null($this->detailsPerCategory)) {
return array_map(function ($value) {
return $value->to(); /*class*/
}, $this->detailsPerCategory);
} else {
return null;
}
}
throw new Exception('never get to this IndustryAssemblyLine::detailsPerCategory');
}
/**
* @param array|null
* @return bool
* @throws Exception
*/
public static function validateDetailsPerCategory(?array $value): bool {
if (!is_null($value)) {
if (!is_array($value)) {
throw new Exception("Attribute Error:IndustryAssemblyLine::detailsPerCategory");
}
array_walk($value, function($value_v) {
$value_v->validate();
});
}
return true;
}
/**
* @throws Exception
* @return ?array
*/
public function getDetailsPerCategory(): ?array {
if (IndustryAssemblyLine::validateDetailsPerCategory($this->detailsPerCategory)) {
return $this->detailsPerCategory;
}
throw new Exception('never get to getDetailsPerCategory IndustryAssemblyLine::detailsPerCategory');
}
/**
* @return ?array
*/
public static function sampleDetailsPerCategory(): ?array {
return array(
DetailsPerCategory::sample() /*37:*/
); /* 37:detailsPerCategory*/
}
/**
* @param ?array $value
* @throws Exception
* @return ?array
*/
public static function fromDetailsPerGroup(?array $value): ?array {
if (!is_null($value)) {
return array_map(function ($value) {
return DetailsPerGroup::from($value); /*class*/
}, $value);
} else {
return null;
}
}
/**
* @throws Exception
* @return ?array
*/
public function toDetailsPerGroup(): ?array {
if (IndustryAssemblyLine::validateDetailsPerGroup($this->detailsPerGroup)) {
if (!is_null($this->detailsPerGroup)) {
return array_map(function ($value) {
return $value->to(); /*class*/
}, $this->detailsPerGroup);
} else {
return null;
}
}
throw new Exception('never get to this IndustryAssemblyLine::detailsPerGroup');
}
/**
* @param array|null
* @return bool
* @throws Exception
*/
public static function validateDetailsPerGroup(?array $value): bool {
if (!is_null($value)) {
if (!is_array($value)) {
throw new Exception("Attribute Error:IndustryAssemblyLine::detailsPerGroup");
}
array_walk($value, function($value_v) {
$value_v->validate();
});
}
return true;
}
/**
* @throws Exception
* @return ?array
*/
public function getDetailsPerGroup(): ?array {
if (IndustryAssemblyLine::validateDetailsPerGroup($this->detailsPerGroup)) {
return $this->detailsPerGroup;
}
throw new Exception('never get to getDetailsPerGroup IndustryAssemblyLine::detailsPerGroup');
}
/**
* @return ?array
*/
public static function sampleDetailsPerGroup(): ?array {
return array(
DetailsPerGroup::sample() /*38:*/
); /* 38:detailsPerGroup*/
}
/**
* @param ?array $value
* @throws Exception
* @return ?array
*/
public static function fromDetailsPerTypeList(?array $value): ?array {
if (!is_null($value)) {
return array_map(function ($value) {
return DetailsPerTypeList::from($value); /*class*/
}, $value);
} else {
return null;
}
}
/**
* @throws Exception
* @return ?array
*/
public function toDetailsPerTypeList(): ?array {
if (IndustryAssemblyLine::validateDetailsPerTypeList($this->detailsPerTypeList)) {
if (!is_null($this->detailsPerTypeList)) {
return array_map(function ($value) {
return $value->to(); /*class*/
}, $this->detailsPerTypeList);
} else {
return null;
}
}
throw new Exception('never get to this IndustryAssemblyLine::detailsPerTypeList');
}
/**
* @param array|null
* @return bool
* @throws Exception
*/
public static function validateDetailsPerTypeList(?array $value): bool {
if (!is_null($value)) {
if (!is_array($value)) {
throw new Exception("Attribute Error:IndustryAssemblyLine::detailsPerTypeList");
}
array_walk($value, function($value_v) {
$value_v->validate();
});
}
return true;
}
/**
* @throws Exception
* @return ?array
*/
public function getDetailsPerTypeList(): ?array {
if (IndustryAssemblyLine::validateDetailsPerTypeList($this->detailsPerTypeList)) {
return $this->detailsPerTypeList;
}
throw new Exception('never get to getDetailsPerTypeList IndustryAssemblyLine::detailsPerTypeList');
}
/**
* @return ?array
*/
public static function sampleDetailsPerTypeList(): ?array {
return array(
DetailsPerTypeList::sample() /*39:*/
); /* 39:detailsPerTypeList*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromName(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toName(): string {
if (IndustryAssemblyLine::validateName($this->name)) {
return $this->name; /*string*/
}
throw new Exception('never get to this IndustryAssemblyLine::name');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateName(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:IndustryAssemblyLine::name");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getName(): string {
if (IndustryAssemblyLine::validateName($this->name)) {
return $this->name;
}
throw new Exception('never get to getName IndustryAssemblyLine::name');
}
/**
* @return string
*/
public static function sampleName(): string {
return 'IndustryAssemblyLine::name::40'; /*40:name*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return IndustryAssemblyLine::validateKey($this->key)
|| IndustryAssemblyLine::validateActivityId($this->activityId)
|| IndustryAssemblyLine::validateBaseCostMultiplier($this->baseCostMultiplier)
|| IndustryAssemblyLine::validateBaseMaterialMultiplier($this->baseMaterialMultiplier)
|| IndustryAssemblyLine::validateBaseTimeMultiplier($this->baseTimeMultiplier)
|| IndustryAssemblyLine::validateDescription($this->description)
|| IndustryAssemblyLine::validateDetailsPerCategory($this->detailsPerCategory)
|| IndustryAssemblyLine::validateDetailsPerGroup($this->detailsPerGroup)
|| IndustryAssemblyLine::validateDetailsPerTypeList($this->detailsPerTypeList)
|| IndustryAssemblyLine::validateName($this->name);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'_key'} = $this->toKey();
$out->{'activityID'} = $this->toActivityId();
$out->{'baseCostMultiplier'} = $this->toBaseCostMultiplier();
$out->{'baseMaterialMultiplier'} = $this->toBaseMaterialMultiplier();
$out->{'baseTimeMultiplier'} = $this->toBaseTimeMultiplier();
$out->{'description'} = $this->toDescription();
$out->{'detailsPerCategory'} = $this->toDetailsPerCategory();
$out->{'detailsPerGroup'} = $this->toDetailsPerGroup();
$out->{'detailsPerTypeList'} = $this->toDetailsPerTypeList();
$out->{'name'} = $this->toName();
return $out;
}
/**
* @param stdClass $obj
* @return IndustryAssemblyLine
* @throws Exception
*/
public static function from(stdClass $obj): IndustryAssemblyLine {
return new IndustryAssemblyLine(
IndustryAssemblyLine::fromKey($obj->{'_key'})
,IndustryAssemblyLine::fromActivityId($obj->{'activityID'})
,IndustryAssemblyLine::fromBaseCostMultiplier($obj->{'baseCostMultiplier'})
,IndustryAssemblyLine::fromBaseMaterialMultiplier($obj->{'baseMaterialMultiplier'})
,IndustryAssemblyLine::fromBaseTimeMultiplier($obj->{'baseTimeMultiplier'})
,IndustryAssemblyLine::fromDescription($obj->{'description'})
,IndustryAssemblyLine::fromDetailsPerCategory($obj->{'detailsPerCategory'})
,IndustryAssemblyLine::fromDetailsPerGroup($obj->{'detailsPerGroup'})
,IndustryAssemblyLine::fromDetailsPerTypeList($obj->{'detailsPerTypeList'})
,IndustryAssemblyLine::fromName($obj->{'name'})
);
}
/**
* @return IndustryAssemblyLine
*/
public static function sample(): IndustryAssemblyLine {
return new IndustryAssemblyLine(
IndustryAssemblyLine::sampleKey()
,IndustryAssemblyLine::sampleActivityId()
,IndustryAssemblyLine::sampleBaseCostMultiplier()
,IndustryAssemblyLine::sampleBaseMaterialMultiplier()
,IndustryAssemblyLine::sampleBaseTimeMultiplier()
,IndustryAssemblyLine::sampleDescription()
,IndustryAssemblyLine::sampleDetailsPerCategory()
,IndustryAssemblyLine::sampleDetailsPerGroup()
,IndustryAssemblyLine::sampleDetailsPerTypeList()
,IndustryAssemblyLine::sampleName()
);
}
}
// This is an autogenerated file:DetailsPerCategory
class DetailsPerCategory {
private int $categoryId; // json:categoryID Required
private ?float $costMultiplier; // json:costMultiplier Optional
private float $materialMultiplier; // json:materialMultiplier Required
private float $timeMultiplier; // json:timeMultiplier Required
/**
* @param int $categoryId
* @param float|null $costMultiplier
* @param float $materialMultiplier
* @param float $timeMultiplier
*/
public function __construct(int $categoryId, ?float $costMultiplier, float $materialMultiplier, float $timeMultiplier) {
$this->categoryId = $categoryId;
$this->costMultiplier = $costMultiplier;
$this->materialMultiplier = $materialMultiplier;
$this->timeMultiplier = $timeMultiplier;
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromCategoryId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toCategoryId(): int {
if (DetailsPerCategory::validateCategoryId($this->categoryId)) {
return $this->categoryId; /*int*/
}
throw new Exception('never get to this DetailsPerCategory::categoryId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateCategoryId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:DetailsPerCategory::categoryId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getCategoryId(): int {
if (DetailsPerCategory::validateCategoryId($this->categoryId)) {
return $this->categoryId;
}
throw new Exception('never get to getCategoryId DetailsPerCategory::categoryId');
}
/**
* @return int
*/
public static function sampleCategoryId(): int {
return 31; /*31:categoryId*/
}
/**
* @param ?float $value
* @throws Exception
* @return ?float
*/
public static function fromCostMultiplier(?float $value): ?float {
if (!is_null($value)) {
return $value; /*float*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?float
*/
public function toCostMultiplier(): ?float {
if (DetailsPerCategory::validateCostMultiplier($this->costMultiplier)) {
if (!is_null($this->costMultiplier)) {
return $this->costMultiplier; /*float*/
} else {
return null;
}
}
throw new Exception('never get to this DetailsPerCategory::costMultiplier');
}
/**
* @param float|null
* @return bool
* @throws Exception
*/
public static function validateCostMultiplier(?float $value): bool {
if (!is_null($value)) {
if (!is_float($value) && !is_int($value)) {
throw new Exception("Attribute Error:DetailsPerCategory::costMultiplier");
}
}
return true;
}
/**
* @throws Exception
* @return ?float
*/
public function getCostMultiplier(): ?float {
if (DetailsPerCategory::validateCostMultiplier($this->costMultiplier)) {
return $this->costMultiplier;
}
throw new Exception('never get to getCostMultiplier DetailsPerCategory::costMultiplier');
}
/**
* @return ?float
*/
public static function sampleCostMultiplier(): ?float {
return 32.032; /*32:costMultiplier*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromMaterialMultiplier(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toMaterialMultiplier(): float {
if (DetailsPerCategory::validateMaterialMultiplier($this->materialMultiplier)) {
return $this->materialMultiplier; /*float*/
}
throw new Exception('never get to this DetailsPerCategory::materialMultiplier');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateMaterialMultiplier(float $value): bool {
if (!is_float($value) && !is_int($value)) {
throw new Exception("Attribute Error:DetailsPerCategory::materialMultiplier");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getMaterialMultiplier(): float {
if (DetailsPerCategory::validateMaterialMultiplier($this->materialMultiplier)) {
return $this->materialMultiplier;
}
throw new Exception('never get to getMaterialMultiplier DetailsPerCategory::materialMultiplier');
}
/**
* @return float
*/
public static function sampleMaterialMultiplier(): float {
return 33.033; /*33:materialMultiplier*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromTimeMultiplier(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toTimeMultiplier(): float {
if (DetailsPerCategory::validateTimeMultiplier($this->timeMultiplier)) {
return $this->timeMultiplier; /*float*/
}
throw new Exception('never get to this DetailsPerCategory::timeMultiplier');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateTimeMultiplier(float $value): bool {
if (!is_float($value) && !is_int($value)) {
throw new Exception("Attribute Error:DetailsPerCategory::timeMultiplier");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getTimeMultiplier(): float {
if (DetailsPerCategory::validateTimeMultiplier($this->timeMultiplier)) {
return $this->timeMultiplier;
}
throw new Exception('never get to getTimeMultiplier DetailsPerCategory::timeMultiplier');
}
/**
* @return float
*/
public static function sampleTimeMultiplier(): float {
return 34.034; /*34:timeMultiplier*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return DetailsPerCategory::validateCategoryId($this->categoryId)
|| DetailsPerCategory::validateCostMultiplier($this->costMultiplier)
|| DetailsPerCategory::validateMaterialMultiplier($this->materialMultiplier)
|| DetailsPerCategory::validateTimeMultiplier($this->timeMultiplier);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'categoryID'} = $this->toCategoryId();
$out->{'costMultiplier'} = $this->toCostMultiplier();
$out->{'materialMultiplier'} = $this->toMaterialMultiplier();
$out->{'timeMultiplier'} = $this->toTimeMultiplier();
return $out;
}
/**
* @param stdClass $obj
* @return DetailsPerCategory
* @throws Exception
*/
public static function from(stdClass $obj): DetailsPerCategory {
return new DetailsPerCategory(
DetailsPerCategory::fromCategoryId($obj->{'categoryID'})
,DetailsPerCategory::fromCostMultiplier($obj->{'costMultiplier'})
,DetailsPerCategory::fromMaterialMultiplier($obj->{'materialMultiplier'})
,DetailsPerCategory::fromTimeMultiplier($obj->{'timeMultiplier'})
);
}
/**
* @return DetailsPerCategory
*/
public static function sample(): DetailsPerCategory {
return new DetailsPerCategory(
DetailsPerCategory::sampleCategoryId()
,DetailsPerCategory::sampleCostMultiplier()
,DetailsPerCategory::sampleMaterialMultiplier()
,DetailsPerCategory::sampleTimeMultiplier()
);
}
}
// This is an autogenerated file:DetailsPerGroup
class DetailsPerGroup {
private ?float $costMultiplier; // json:costMultiplier Optional
private int $groupId; // json:groupID Required
private float $materialMultiplier; // json:materialMultiplier Required
private float $timeMultiplier; // json:timeMultiplier Required
/**
* @param float|null $costMultiplier
* @param int $groupId
* @param float $materialMultiplier
* @param float $timeMultiplier
*/
public function __construct(?float $costMultiplier, int $groupId, float $materialMultiplier, float $timeMultiplier) {
$this->costMultiplier = $costMultiplier;
$this->groupId = $groupId;
$this->materialMultiplier = $materialMultiplier;
$this->timeMultiplier = $timeMultiplier;
}
/**
* @param ?float $value
* @throws Exception
* @return ?float
*/
public static function fromCostMultiplier(?float $value): ?float {
if (!is_null($value)) {
return $value; /*float*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?float
*/
public function toCostMultiplier(): ?float {
if (DetailsPerGroup::validateCostMultiplier($this->costMultiplier)) {
if (!is_null($this->costMultiplier)) {
return $this->costMultiplier; /*float*/
} else {
return null;
}
}
throw new Exception('never get to this DetailsPerGroup::costMultiplier');
}
/**
* @param float|null
* @return bool
* @throws Exception
*/
public static function validateCostMultiplier(?float $value): bool {
if (!is_null($value)) {
if (!is_float($value) && !is_int($value)) {
throw new Exception("Attribute Error:DetailsPerGroup::costMultiplier");
}
}
return true;
}
/**
* @throws Exception
* @return ?float
*/
public function getCostMultiplier(): ?float {
if (DetailsPerGroup::validateCostMultiplier($this->costMultiplier)) {
return $this->costMultiplier;
}
throw new Exception('never get to getCostMultiplier DetailsPerGroup::costMultiplier');
}
/**
* @return ?float
*/
public static function sampleCostMultiplier(): ?float {
return 31.031; /*31:costMultiplier*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromGroupId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toGroupId(): int {
if (DetailsPerGroup::validateGroupId($this->groupId)) {
return $this->groupId; /*int*/
}
throw new Exception('never get to this DetailsPerGroup::groupId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateGroupId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:DetailsPerGroup::groupId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getGroupId(): int {
if (DetailsPerGroup::validateGroupId($this->groupId)) {
return $this->groupId;
}
throw new Exception('never get to getGroupId DetailsPerGroup::groupId');
}
/**
* @return int
*/
public static function sampleGroupId(): int {
return 32; /*32:groupId*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromMaterialMultiplier(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toMaterialMultiplier(): float {
if (DetailsPerGroup::validateMaterialMultiplier($this->materialMultiplier)) {
return $this->materialMultiplier; /*float*/
}
throw new Exception('never get to this DetailsPerGroup::materialMultiplier');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateMaterialMultiplier(float $value): bool {
if (!is_float($value) && !is_int($value)) {
throw new Exception("Attribute Error:DetailsPerGroup::materialMultiplier");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getMaterialMultiplier(): float {
if (DetailsPerGroup::validateMaterialMultiplier($this->materialMultiplier)) {
return $this->materialMultiplier;
}
throw new Exception('never get to getMaterialMultiplier DetailsPerGroup::materialMultiplier');
}
/**
* @return float
*/
public static function sampleMaterialMultiplier(): float {
return 33.033; /*33:materialMultiplier*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromTimeMultiplier(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toTimeMultiplier(): float {
if (DetailsPerGroup::validateTimeMultiplier($this->timeMultiplier)) {
return $this->timeMultiplier; /*float*/
}
throw new Exception('never get to this DetailsPerGroup::timeMultiplier');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateTimeMultiplier(float $value): bool {
if (!is_float($value) && !is_int($value)) {
throw new Exception("Attribute Error:DetailsPerGroup::timeMultiplier");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getTimeMultiplier(): float {
if (DetailsPerGroup::validateTimeMultiplier($this->timeMultiplier)) {
return $this->timeMultiplier;
}
throw new Exception('never get to getTimeMultiplier DetailsPerGroup::timeMultiplier');
}
/**
* @return float
*/
public static function sampleTimeMultiplier(): float {
return 34.034; /*34:timeMultiplier*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return DetailsPerGroup::validateCostMultiplier($this->costMultiplier)
|| DetailsPerGroup::validateGroupId($this->groupId)
|| DetailsPerGroup::validateMaterialMultiplier($this->materialMultiplier)
|| DetailsPerGroup::validateTimeMultiplier($this->timeMultiplier);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'costMultiplier'} = $this->toCostMultiplier();
$out->{'groupID'} = $this->toGroupId();
$out->{'materialMultiplier'} = $this->toMaterialMultiplier();
$out->{'timeMultiplier'} = $this->toTimeMultiplier();
return $out;
}
/**
* @param stdClass $obj
* @return DetailsPerGroup
* @throws Exception
*/
public static function from(stdClass $obj): DetailsPerGroup {
return new DetailsPerGroup(
DetailsPerGroup::fromCostMultiplier($obj->{'costMultiplier'})
,DetailsPerGroup::fromGroupId($obj->{'groupID'})
,DetailsPerGroup::fromMaterialMultiplier($obj->{'materialMultiplier'})
,DetailsPerGroup::fromTimeMultiplier($obj->{'timeMultiplier'})
);
}
/**
* @return DetailsPerGroup
*/
public static function sample(): DetailsPerGroup {
return new DetailsPerGroup(
DetailsPerGroup::sampleCostMultiplier()
,DetailsPerGroup::sampleGroupId()
,DetailsPerGroup::sampleMaterialMultiplier()
,DetailsPerGroup::sampleTimeMultiplier()
);
}
}
// This is an autogenerated file:DetailsPerTypeList
class DetailsPerTypeList {
private float $materialMultiplier; // json:materialMultiplier Required
private float $timeMultiplier; // json:timeMultiplier Required
/**
* @param float $materialMultiplier
* @param float $timeMultiplier
*/
public function __construct(float $materialMultiplier, float $timeMultiplier) {
$this->materialMultiplier = $materialMultiplier;
$this->timeMultiplier = $timeMultiplier;
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromMaterialMultiplier(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toMaterialMultiplier(): float {
if (DetailsPerTypeList::validateMaterialMultiplier($this->materialMultiplier)) {
return $this->materialMultiplier; /*float*/
}
throw new Exception('never get to this DetailsPerTypeList::materialMultiplier');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateMaterialMultiplier(float $value): bool {
if (!is_float($value) && !is_int($value)) {
throw new Exception("Attribute Error:DetailsPerTypeList::materialMultiplier");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getMaterialMultiplier(): float {
if (DetailsPerTypeList::validateMaterialMultiplier($this->materialMultiplier)) {
return $this->materialMultiplier;
}
throw new Exception('never get to getMaterialMultiplier DetailsPerTypeList::materialMultiplier');
}
/**
* @return float
*/
public static function sampleMaterialMultiplier(): float {
return 31.031; /*31:materialMultiplier*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromTimeMultiplier(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toTimeMultiplier(): float {
if (DetailsPerTypeList::validateTimeMultiplier($this->timeMultiplier)) {
return $this->timeMultiplier; /*float*/
}
throw new Exception('never get to this DetailsPerTypeList::timeMultiplier');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateTimeMultiplier(float $value): bool {
if (!is_float($value) && !is_int($value)) {
throw new Exception("Attribute Error:DetailsPerTypeList::timeMultiplier");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getTimeMultiplier(): float {
if (DetailsPerTypeList::validateTimeMultiplier($this->timeMultiplier)) {
return $this->timeMultiplier;
}
throw new Exception('never get to getTimeMultiplier DetailsPerTypeList::timeMultiplier');
}
/**
* @return float
*/
public static function sampleTimeMultiplier(): float {
return 32.032; /*32:timeMultiplier*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return DetailsPerTypeList::validateMaterialMultiplier($this->materialMultiplier)
|| DetailsPerTypeList::validateTimeMultiplier($this->timeMultiplier);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'materialMultiplier'} = $this->toMaterialMultiplier();
$out->{'timeMultiplier'} = $this->toTimeMultiplier();
return $out;
}
/**
* @param stdClass $obj
* @return DetailsPerTypeList
* @throws Exception
*/
public static function from(stdClass $obj): DetailsPerTypeList {
return new DetailsPerTypeList(
DetailsPerTypeList::fromMaterialMultiplier($obj->{'materialMultiplier'})
,DetailsPerTypeList::fromTimeMultiplier($obj->{'timeMultiplier'})
);
}
/**
* @return DetailsPerTypeList
*/
public static function sample(): DetailsPerTypeList {
return new DetailsPerTypeList(
DetailsPerTypeList::sampleMaterialMultiplier()
,DetailsPerTypeList::sampleTimeMultiplier()
);
}
}
from dataclasses import dataclass
from typing import Any, TypeVar, Callable, Type, cast
T = TypeVar("T")
def from_int(x: Any) -> int:
assert isinstance(x, int) and not isinstance(x, bool)
return x
def from_float(x: Any) -> float:
assert isinstance(x, (float, int)) and not isinstance(x, bool)
return float(x)
def from_none(x: Any) -> Any:
assert x is None
return x
def from_union(fs, x):
for f in fs:
try:
return f(x)
except:
pass
assert False
def to_float(x: Any) -> float:
assert isinstance(x, (int, float))
return x
def from_str(x: Any) -> str:
assert isinstance(x, str)
return x
def from_list(f: Callable[[Any], T], x: Any) -> list[T]:
assert isinstance(x, list)
return [f(y) for y in x]
def to_class(c: Type[T], x: Any) -> dict:
assert isinstance(x, c)
return cast(Any, x).to_dict()
@dataclass
class DetailsPerCategory:
category_id: int
material_multiplier: float
time_multiplier: float
cost_multiplier: float | None = None
@staticmethod
def from_dict(obj: Any) -> 'DetailsPerCategory':
assert isinstance(obj, dict)
category_id = from_int(obj.get("categoryID"))
material_multiplier = from_float(obj.get("materialMultiplier"))
time_multiplier = from_float(obj.get("timeMultiplier"))
cost_multiplier = from_union([from_float, from_none], obj.get("costMultiplier"))
return DetailsPerCategory(category_id, material_multiplier, time_multiplier, cost_multiplier)
def to_dict(self) -> dict:
result: dict = {}
result["categoryID"] = from_int(self.category_id)
result["materialMultiplier"] = to_float(self.material_multiplier)
result["timeMultiplier"] = to_float(self.time_multiplier)
if self.cost_multiplier is not None:
result["costMultiplier"] = from_union([to_float, from_none], self.cost_multiplier)
return result
@dataclass
class DetailsPerGroup:
group_id: int
material_multiplier: float
time_multiplier: float
cost_multiplier: float | None = None
@staticmethod
def from_dict(obj: Any) -> 'DetailsPerGroup':
assert isinstance(obj, dict)
group_id = from_int(obj.get("groupID"))
material_multiplier = from_float(obj.get("materialMultiplier"))
time_multiplier = from_float(obj.get("timeMultiplier"))
cost_multiplier = from_union([from_float, from_none], obj.get("costMultiplier"))
return DetailsPerGroup(group_id, material_multiplier, time_multiplier, cost_multiplier)
def to_dict(self) -> dict:
result: dict = {}
result["groupID"] = from_int(self.group_id)
result["materialMultiplier"] = to_float(self.material_multiplier)
result["timeMultiplier"] = to_float(self.time_multiplier)
if self.cost_multiplier is not None:
result["costMultiplier"] = from_union([to_float, from_none], self.cost_multiplier)
return result
@dataclass
class DetailsPerTypeList:
material_multiplier: float
time_multiplier: float
@staticmethod
def from_dict(obj: Any) -> 'DetailsPerTypeList':
assert isinstance(obj, dict)
material_multiplier = from_float(obj.get("materialMultiplier"))
time_multiplier = from_float(obj.get("timeMultiplier"))
return DetailsPerTypeList(material_multiplier, time_multiplier)
def to_dict(self) -> dict:
result: dict = {}
result["materialMultiplier"] = to_float(self.material_multiplier)
result["timeMultiplier"] = to_float(self.time_multiplier)
return result
@dataclass
class IndustryAssemblyLine:
key: int
activity_id: int
base_material_multiplier: float
base_time_multiplier: float
name: str
base_cost_multiplier: float | None = None
description: str | None = None
details_per_category: list[DetailsPerCategory] | None = None
details_per_group: list[DetailsPerGroup] | None = None
details_per_type_list: list[DetailsPerTypeList] | None = None
@staticmethod
def from_dict(obj: Any) -> 'IndustryAssemblyLine':
assert isinstance(obj, dict)
key = from_int(obj.get("_key"))
activity_id = from_int(obj.get("activityID"))
base_material_multiplier = from_float(obj.get("baseMaterialMultiplier"))
base_time_multiplier = from_float(obj.get("baseTimeMultiplier"))
name = from_str(obj.get("name"))
base_cost_multiplier = from_union([from_float, from_none], obj.get("baseCostMultiplier"))
description = from_union([from_str, from_none], obj.get("description"))
details_per_category = from_union([lambda x: from_list(DetailsPerCategory.from_dict, x), from_none], obj.get("detailsPerCategory"))
details_per_group = from_union([lambda x: from_list(DetailsPerGroup.from_dict, x), from_none], obj.get("detailsPerGroup"))
details_per_type_list = from_union([lambda x: from_list(DetailsPerTypeList.from_dict, x), from_none], obj.get("detailsPerTypeList"))
return IndustryAssemblyLine(key, activity_id, base_material_multiplier, base_time_multiplier, name, base_cost_multiplier, description, details_per_category, details_per_group, details_per_type_list)
def to_dict(self) -> dict:
result: dict = {}
result["_key"] = from_int(self.key)
result["activityID"] = from_int(self.activity_id)
result["baseMaterialMultiplier"] = to_float(self.base_material_multiplier)
result["baseTimeMultiplier"] = to_float(self.base_time_multiplier)
result["name"] = from_str(self.name)
if self.base_cost_multiplier is not None:
result["baseCostMultiplier"] = from_union([to_float, from_none], self.base_cost_multiplier)
if self.description is not None:
result["description"] = from_union([from_str, from_none], self.description)
if self.details_per_category is not None:
result["detailsPerCategory"] = from_union([lambda x: from_list(lambda x: to_class(DetailsPerCategory, x), x), from_none], self.details_per_category)
if self.details_per_group is not None:
result["detailsPerGroup"] = from_union([lambda x: from_list(lambda x: to_class(DetailsPerGroup, x), x), from_none], self.details_per_group)
if self.details_per_type_list is not None:
result["detailsPerTypeList"] = from_union([lambda x: from_list(lambda x: to_class(DetailsPerTypeList, x), x), from_none], self.details_per_type_list)
return result
def industry_assembly_line_from_dict(s: Any) -> IndustryAssemblyLine:
return IndustryAssemblyLine.from_dict(s)
def industry_assembly_line_to_dict(x: IndustryAssemblyLine) -> Any:
return to_class(IndustryAssemblyLine, x)
// To parse this data:
//
// import { Convert, IndustryAssemblyLine } from "./IndustryAssemblyLine";
//
// const industryAssemblyLine = Convert.toIndustryAssemblyLine(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.
export interface IndustryAssemblyLine {
_key: number;
activityID: number;
baseCostMultiplier?: number;
baseMaterialMultiplier: number;
baseTimeMultiplier: number;
description?: string;
detailsPerCategory?: [DetailsPerCategory, ...DetailsPerCategory[]];
detailsPerGroup?: [DetailsPerGroup, ...DetailsPerGroup[]];
detailsPerTypeList?: [DetailsPerTypeList, ...DetailsPerTypeList[]];
name: string;
[property: string]: unknown;
}
export interface DetailsPerCategory {
categoryID: number;
costMultiplier?: number;
materialMultiplier: number;
timeMultiplier: number;
[property: string]: unknown;
}
export interface DetailsPerGroup {
costMultiplier?: number;
groupID: number;
materialMultiplier: number;
timeMultiplier: number;
[property: string]: unknown;
}
export interface DetailsPerTypeList {
materialMultiplier: number;
timeMultiplier: number;
[property: string]: unknown;
}
// Converts JSON strings to/from your types
// and asserts the results of JSON.parse at runtime
export class Convert {
public static toIndustryAssemblyLine(json: string): IndustryAssemblyLine {
return cast(JSON.parse(json), r("IndustryAssemblyLine"));
}
public static industryAssemblyLineToJson(value: IndustryAssemblyLine): string {
return JSON.stringify(uncast(value, r("IndustryAssemblyLine")), null, 2);
}
}
function invalidValue(typ: any, val: any, key: any, parent: any = ''): never {
const prettyTyp = prettyTypeName(typ);
const parentText = parent ? ` on ${parent}` : '';
const keyText = key ? ` for key "${key}"` : '';
throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`);
}
function prettyTypeName(typ: any): string {
if (Array.isArray(typ)) {
if (typ.length === 2 && typ[0] === undefined) {
return `an optional ${prettyTypeName(typ[1])}`;
} else {
return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`;
}
} else if (typeof typ === "object" && typ.literal !== undefined) {
return typ.literal;
} else {
return typeof typ;
}
}
function jsonToJSProps(typ: any): any {
if (typ.jsonToJS === undefined) {
const map: any = {};
typ.props.forEach((p: any) => map[p.json] = { key: p.js, typ: p.typ });
typ.jsonToJS = map;
}
return typ.jsonToJS;
}
function jsToJSONProps(typ: any): any {
if (typ.jsToJSON === undefined) {
const map: any = {};
typ.props.forEach((p: any) => map[p.js] = { key: p.json, typ: p.typ });
typ.jsToJSON = map;
}
return typ.jsToJSON;
}
function transform(val: any, typ: any, getProps: any, key: any = '', parent: any = ''): any {
function transformPrimitive(typ: string, val: any): any {
if (typeof typ === typeof val) return val;
return invalidValue(typ, val, key, parent);
}
function transformUnion(typs: any[], val: any): any {
// val must validate against one typ in typs
const l = typs.length;
for (let i = 0; i < l; i++) {
const typ = typs[i];
try {
return transform(val, typ, getProps);
} catch (_) {}
}
return invalidValue(typs, val, key, parent);
}
function transformEnum(cases: string[], val: any): any {
if (cases.indexOf(val) !== -1) return val;
return invalidValue(cases.map(a => { return l(a); }), val, key, parent);
}
function transformArray(typ: any, val: any): any {
// val must be an array with no invalid elements
if (!Array.isArray(val)) return invalidValue(l("array"), val, key, parent);
return val.map(el => transform(el, typ, getProps));
}
function transformDate(val: any): any {
if (val === null) {
return null;
}
const d = new Date(val);
if (isNaN(d.valueOf())) {
return invalidValue(l("Date"), val, key, parent);
}
return d;
}
function transformObject(props: { [k: string]: any }, additional: any, val: any): any {
if (val === null || typeof val !== "object" || Array.isArray(val)) {
return invalidValue(l(ref || "object"), val, key, parent);
}
const result: any = {};
Object.getOwnPropertyNames(props).forEach(key => {
const prop = props[key];
const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined;
result[prop.key] = transform(v, prop.typ, getProps, key, ref);
});
Object.getOwnPropertyNames(val).forEach(key => {
if (!Object.prototype.hasOwnProperty.call(props, key)) {
result[key] = transform(val[key], additional, getProps, key, ref);
}
});
return result;
}
if (typ === "any") return val;
if (typ === null) {
if (val === null) return val;
return invalidValue(typ, val, key, parent);
}
if (typ === false) return invalidValue(typ, val, key, parent);
let ref: any = undefined;
while (typeof typ === "object" && typ.ref !== undefined) {
ref = typ.ref;
typ = typeMap[typ.ref];
}
if (Array.isArray(typ)) return transformEnum(typ, val);
if (typeof typ === "object") {
return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val)
: typ.hasOwnProperty("arrayItems") ? transformArray(typ.arrayItems, val)
: typ.hasOwnProperty("props") ? transformObject(getProps(typ), typ.additional, val)
: invalidValue(typ, val, key, parent);
}
// Numbers can be parsed by Date but shouldn't be.
if (typ === Date && typeof val !== "number") return transformDate(val);
return transformPrimitive(typ, val);
}
function cast<T>(val: any, typ: any): T {
return transform(val, typ, jsonToJSProps);
}
function uncast<T>(val: T, typ: any): any {
return transform(val, typ, jsToJSONProps);
}
function l(typ: any) {
return { literal: typ };
}
function a(typ: any) {
return { arrayItems: typ };
}
function u(...typs: any[]) {
return { unionMembers: typs };
}
function o(props: any[], additional: any) {
return { props, additional };
}
function m(additional: any) {
return { props: [], additional };
}
function r(name: string) {
return { ref: name };
}
const typeMap: any = {
"IndustryAssemblyLine": o([
{ json: "_key", js: "_key", typ: 0 },
{ json: "activityID", js: "activityID", typ: 0 },
{ json: "baseCostMultiplier", js: "baseCostMultiplier", typ: u(undefined, 3.14) },
{ json: "baseMaterialMultiplier", js: "baseMaterialMultiplier", typ: 3.14 },
{ json: "baseTimeMultiplier", js: "baseTimeMultiplier", typ: 3.14 },
{ json: "description", js: "description", typ: u(undefined, "") },
{ json: "detailsPerCategory", js: "detailsPerCategory", typ: u(undefined, a(r("DetailsPerCategory"))) },
{ json: "detailsPerGroup", js: "detailsPerGroup", typ: u(undefined, a(r("DetailsPerGroup"))) },
{ json: "detailsPerTypeList", js: "detailsPerTypeList", typ: u(undefined, a(r("DetailsPerTypeList"))) },
{ json: "name", js: "name", typ: "" },
], "any"),
"DetailsPerCategory": o([
{ json: "categoryID", js: "categoryID", typ: 0 },
{ json: "costMultiplier", js: "costMultiplier", typ: u(undefined, 3.14) },
{ json: "materialMultiplier", js: "materialMultiplier", typ: 3.14 },
{ json: "timeMultiplier", js: "timeMultiplier", typ: 3.14 },
], "any"),
"DetailsPerGroup": o([
{ json: "costMultiplier", js: "costMultiplier", typ: u(undefined, 3.14) },
{ json: "groupID", js: "groupID", typ: 0 },
{ json: "materialMultiplier", js: "materialMultiplier", typ: 3.14 },
{ json: "timeMultiplier", js: "timeMultiplier", typ: 3.14 },
], "any"),
"DetailsPerTypeList": o([
{ json: "materialMultiplier", js: "materialMultiplier", typ: 3.14 },
{ json: "timeMultiplier", js: "timeMultiplier", typ: 3.14 },
], "any"),
};