// <auto-generated>
/*
 * OpenAPI Petstore
 *
 * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
 *
 * The version of the OpenAPI document: 1.0.0
 * Generated by: https://github.com/openapitools/openapi-generator.git
 */

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
using Org.OpenAPITools.Client;

namespace Org.OpenAPITools.Model
{
    /// <summary>
    /// MixLog
    /// </summary>
    public partial class MixLog : IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="MixLog" /> class.
        /// </summary>
        /// <param name="description">description</param>
        /// <param name="formulaVersionDate">formulaVersionDate</param>
        /// <param name="id">id</param>
        /// <param name="mixDate">mixDate</param>
        /// <param name="totalOverPoors">totalOverPoors</param>
        /// <param name="totalRecalculations">totalRecalculations</param>
        /// <param name="totalSkips">totalSkips</param>
        /// <param name="totalUnderPours">totalUnderPours</param>
        /// <param name="batchNumber">batchNumber</param>
        /// <param name="brandCode">BrandCode is only required for non-color mixes</param>
        /// <param name="brandId">BrandId is only required for color mixes</param>
        /// <param name="brandName">BrandName is only required for color mixes</param>
        /// <param name="categoryCode">CategoryCode is not used anymore</param>
        /// <param name="color">Color is only required for color mixes</param>
        /// <param name="colorDescription">colorDescription</param>
        /// <param name="comment">comment</param>
        /// <param name="commercialProductCode">commercialProductCode</param>
        /// <param name="country">country</param>
        /// <param name="createdBy">createdBy</param>
        /// <param name="createdByFirstName">createdByFirstName</param>
        /// <param name="createdByLastName">createdByLastName</param>
        /// <param name="deltaECalculationRepaired">deltaECalculationRepaired</param>
        /// <param name="deltaECalculationSprayout">deltaECalculationSprayout</param>
        /// <param name="ownColorVariantNumber">ownColorVariantNumber</param>
        /// <param name="primerProductId">primerProductId</param>
        /// <param name="productId">ProductId is only required for color mixes</param>
        /// <param name="productLineCode">ProductLineCode is only required for color mixes</param>
        /// <param name="productName">ProductName is only required for color mixes</param>
        /// <param name="selectedVersionIndex">selectedVersionIndex</param>
        /// <param name="shopId">shopId</param>
        /// <param name="someCode">SomeCode is only required for color mixes</param>
        /// <param name="totalPrice">totalPrice</param>
        [JsonConstructor]
        public MixLog(string description, DateTime formulaVersionDate, Guid id, DateTime mixDate, int totalOverPoors, int totalRecalculations, int totalSkips, int totalUnderPours, Option<string> batchNumber = default, Option<string> brandCode = default, Option<string> brandId = default, Option<string> brandName = default, Option<string> categoryCode = default, Option<string> color = default, Option<string> colorDescription = default, Option<string> comment = default, Option<string> commercialProductCode = default, Option<string> country = default, Option<string> createdBy = default, Option<string> createdByFirstName = default, Option<string> createdByLastName = default, Option<string> deltaECalculationRepaired = default, Option<string> deltaECalculationSprayout = default, Option<int?> ownColorVariantNumber = default, Option<string> primerProductId = default, Option<string> productId = default, Option<string> productLineCode = default, Option<string> productName = default, Option<int?> selectedVersionIndex = default, Option<Guid?> shopId = default, Option<string> someCode = default, Option<float?> totalPrice = default)
        {
            Description = description;
            FormulaVersionDate = formulaVersionDate;
            Id = id;
            MixDate = mixDate;
            TotalOverPoors = totalOverPoors;
            TotalRecalculations = totalRecalculations;
            TotalSkips = totalSkips;
            TotalUnderPours = totalUnderPours;
            BatchNumberOption = batchNumber;
            BrandCodeOption = brandCode;
            BrandIdOption = brandId;
            BrandNameOption = brandName;
            CategoryCodeOption = categoryCode;
            ColorOption = color;
            ColorDescriptionOption = colorDescription;
            CommentOption = comment;
            CommercialProductCodeOption = commercialProductCode;
            CountryOption = country;
            CreatedByOption = createdBy;
            CreatedByFirstNameOption = createdByFirstName;
            CreatedByLastNameOption = createdByLastName;
            DeltaECalculationRepairedOption = deltaECalculationRepaired;
            DeltaECalculationSprayoutOption = deltaECalculationSprayout;
            OwnColorVariantNumberOption = ownColorVariantNumber;
            PrimerProductIdOption = primerProductId;
            ProductIdOption = productId;
            ProductLineCodeOption = productLineCode;
            ProductNameOption = productName;
            SelectedVersionIndexOption = selectedVersionIndex;
            ShopIdOption = shopId;
            SomeCodeOption = someCode;
            TotalPriceOption = totalPrice;
            OnCreated();
        }

        partial void OnCreated();

        /// <summary>
        /// Gets or Sets Description
        /// </summary>
        [JsonPropertyName("description")]
        public string Description { get; set; }

        /// <summary>
        /// Gets or Sets FormulaVersionDate
        /// </summary>
        [JsonPropertyName("formulaVersionDate")]
        public DateTime FormulaVersionDate { get; set; }

        /// <summary>
        /// Gets or Sets Id
        /// </summary>
        [JsonPropertyName("id")]
        public Guid Id { get; set; }

        /// <summary>
        /// Gets or Sets MixDate
        /// </summary>
        [JsonPropertyName("mixDate")]
        public DateTime MixDate { get; set; }

        /// <summary>
        /// Gets or Sets TotalOverPoors
        /// </summary>
        [JsonPropertyName("totalOverPoors")]
        public int TotalOverPoors { get; set; }

        /// <summary>
        /// Gets or Sets TotalRecalculations
        /// </summary>
        [JsonPropertyName("totalRecalculations")]
        public int TotalRecalculations { get; set; }

        /// <summary>
        /// Gets or Sets TotalSkips
        /// </summary>
        [JsonPropertyName("totalSkips")]
        public int TotalSkips { get; set; }

        /// <summary>
        /// Gets or Sets TotalUnderPours
        /// </summary>
        [JsonPropertyName("totalUnderPours")]
        public int TotalUnderPours { get; set; }

        /// <summary>
        /// Used to track the state of BatchNumber
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> BatchNumberOption { get; private set; }

        /// <summary>
        /// Gets or Sets BatchNumber
        /// </summary>
        [JsonPropertyName("batchNumber")]
        public string BatchNumber { get { return this.BatchNumberOption; } set { this.BatchNumberOption = new(value); } }

        /// <summary>
        /// Used to track the state of BrandCode
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> BrandCodeOption { get; private set; }

        /// <summary>
        /// BrandCode is only required for non-color mixes
        /// </summary>
        /// <value>BrandCode is only required for non-color mixes</value>
        [JsonPropertyName("brandCode")]
        public string BrandCode { get { return this.BrandCodeOption; } set { this.BrandCodeOption = new(value); } }

        /// <summary>
        /// Used to track the state of BrandId
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> BrandIdOption { get; private set; }

        /// <summary>
        /// BrandId is only required for color mixes
        /// </summary>
        /// <value>BrandId is only required for color mixes</value>
        [JsonPropertyName("brandId")]
        public string BrandId { get { return this.BrandIdOption; } set { this.BrandIdOption = new(value); } }

        /// <summary>
        /// Used to track the state of BrandName
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> BrandNameOption { get; private set; }

        /// <summary>
        /// BrandName is only required for color mixes
        /// </summary>
        /// <value>BrandName is only required for color mixes</value>
        [JsonPropertyName("brandName")]
        public string BrandName { get { return this.BrandNameOption; } set { this.BrandNameOption = new(value); } }

        /// <summary>
        /// Used to track the state of CategoryCode
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> CategoryCodeOption { get; private set; }

        /// <summary>
        /// CategoryCode is not used anymore
        /// </summary>
        /// <value>CategoryCode is not used anymore</value>
        [JsonPropertyName("categoryCode")]
        public string CategoryCode { get { return this.CategoryCodeOption; } set { this.CategoryCodeOption = new(value); } }

        /// <summary>
        /// Used to track the state of Color
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> ColorOption { get; private set; }

        /// <summary>
        /// Color is only required for color mixes
        /// </summary>
        /// <value>Color is only required for color mixes</value>
        [JsonPropertyName("color")]
        public string Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } }

        /// <summary>
        /// Used to track the state of ColorDescription
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> ColorDescriptionOption { get; private set; }

        /// <summary>
        /// Gets or Sets ColorDescription
        /// </summary>
        [JsonPropertyName("colorDescription")]
        public string ColorDescription { get { return this.ColorDescriptionOption; } set { this.ColorDescriptionOption = new(value); } }

        /// <summary>
        /// Used to track the state of Comment
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> CommentOption { get; private set; }

        /// <summary>
        /// Gets or Sets Comment
        /// </summary>
        [JsonPropertyName("comment")]
        public string Comment { get { return this.CommentOption; } set { this.CommentOption = new(value); } }

        /// <summary>
        /// Used to track the state of CommercialProductCode
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> CommercialProductCodeOption { get; private set; }

        /// <summary>
        /// Gets or Sets CommercialProductCode
        /// </summary>
        [JsonPropertyName("commercialProductCode")]
        public string CommercialProductCode { get { return this.CommercialProductCodeOption; } set { this.CommercialProductCodeOption = new(value); } }

        /// <summary>
        /// Used to track the state of Country
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> CountryOption { get; private set; }

        /// <summary>
        /// Gets or Sets Country
        /// </summary>
        [JsonPropertyName("country")]
        public string Country { get { return this.CountryOption; } set { this.CountryOption = new(value); } }

        /// <summary>
        /// Used to track the state of CreatedBy
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> CreatedByOption { get; private set; }

        /// <summary>
        /// Gets or Sets CreatedBy
        /// </summary>
        [JsonPropertyName("createdBy")]
        public string CreatedBy { get { return this.CreatedByOption; } set { this.CreatedByOption = new(value); } }

        /// <summary>
        /// Used to track the state of CreatedByFirstName
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> CreatedByFirstNameOption { get; private set; }

        /// <summary>
        /// Gets or Sets CreatedByFirstName
        /// </summary>
        [JsonPropertyName("createdByFirstName")]
        public string CreatedByFirstName { get { return this.CreatedByFirstNameOption; } set { this.CreatedByFirstNameOption = new(value); } }

        /// <summary>
        /// Used to track the state of CreatedByLastName
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> CreatedByLastNameOption { get; private set; }

        /// <summary>
        /// Gets or Sets CreatedByLastName
        /// </summary>
        [JsonPropertyName("createdByLastName")]
        public string CreatedByLastName { get { return this.CreatedByLastNameOption; } set { this.CreatedByLastNameOption = new(value); } }

        /// <summary>
        /// Used to track the state of DeltaECalculationRepaired
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> DeltaECalculationRepairedOption { get; private set; }

        /// <summary>
        /// Gets or Sets DeltaECalculationRepaired
        /// </summary>
        [JsonPropertyName("deltaECalculationRepaired")]
        public string DeltaECalculationRepaired { get { return this.DeltaECalculationRepairedOption; } set { this.DeltaECalculationRepairedOption = new(value); } }

        /// <summary>
        /// Used to track the state of DeltaECalculationSprayout
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> DeltaECalculationSprayoutOption { get; private set; }

        /// <summary>
        /// Gets or Sets DeltaECalculationSprayout
        /// </summary>
        [JsonPropertyName("deltaECalculationSprayout")]
        public string DeltaECalculationSprayout { get { return this.DeltaECalculationSprayoutOption; } set { this.DeltaECalculationSprayoutOption = new(value); } }

        /// <summary>
        /// Used to track the state of OwnColorVariantNumber
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<int?> OwnColorVariantNumberOption { get; private set; }

        /// <summary>
        /// Gets or Sets OwnColorVariantNumber
        /// </summary>
        [JsonPropertyName("ownColorVariantNumber")]
        public int? OwnColorVariantNumber { get { return this.OwnColorVariantNumberOption; } set { this.OwnColorVariantNumberOption = new(value); } }

        /// <summary>
        /// Used to track the state of PrimerProductId
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> PrimerProductIdOption { get; private set; }

        /// <summary>
        /// Gets or Sets PrimerProductId
        /// </summary>
        [JsonPropertyName("primerProductId")]
        public string PrimerProductId { get { return this.PrimerProductIdOption; } set { this.PrimerProductIdOption = new(value); } }

        /// <summary>
        /// Used to track the state of ProductId
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> ProductIdOption { get; private set; }

        /// <summary>
        /// ProductId is only required for color mixes
        /// </summary>
        /// <value>ProductId is only required for color mixes</value>
        [JsonPropertyName("productId")]
        public string ProductId { get { return this.ProductIdOption; } set { this.ProductIdOption = new(value); } }

        /// <summary>
        /// Used to track the state of ProductLineCode
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> ProductLineCodeOption { get; private set; }

        /// <summary>
        /// ProductLineCode is only required for color mixes
        /// </summary>
        /// <value>ProductLineCode is only required for color mixes</value>
        [JsonPropertyName("productLineCode")]
        public string ProductLineCode { get { return this.ProductLineCodeOption; } set { this.ProductLineCodeOption = new(value); } }

        /// <summary>
        /// Used to track the state of ProductName
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> ProductNameOption { get; private set; }

        /// <summary>
        /// ProductName is only required for color mixes
        /// </summary>
        /// <value>ProductName is only required for color mixes</value>
        [JsonPropertyName("productName")]
        public string ProductName { get { return this.ProductNameOption; } set { this.ProductNameOption = new(value); } }

        /// <summary>
        /// Used to track the state of SelectedVersionIndex
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<int?> SelectedVersionIndexOption { get; private set; }

        /// <summary>
        /// Gets or Sets SelectedVersionIndex
        /// </summary>
        [JsonPropertyName("selectedVersionIndex")]
        public int? SelectedVersionIndex { get { return this.SelectedVersionIndexOption; } set { this.SelectedVersionIndexOption = new(value); } }

        /// <summary>
        /// Used to track the state of ShopId
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<Guid?> ShopIdOption { get; private set; }

        /// <summary>
        /// Gets or Sets ShopId
        /// </summary>
        [JsonPropertyName("shopId")]
        public Guid? ShopId { get { return this.ShopIdOption; } set { this.ShopIdOption = new(value); } }

        /// <summary>
        /// Used to track the state of SomeCode
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<string> SomeCodeOption { get; private set; }

        /// <summary>
        /// SomeCode is only required for color mixes
        /// </summary>
        /// <value>SomeCode is only required for color mixes</value>
        [JsonPropertyName("someCode")]
        public string SomeCode { get { return this.SomeCodeOption; } set { this.SomeCodeOption = new(value); } }

        /// <summary>
        /// Used to track the state of TotalPrice
        /// </summary>
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<float?> TotalPriceOption { get; private set; }

        /// <summary>
        /// Gets or Sets TotalPrice
        /// </summary>
        [JsonPropertyName("totalPrice")]
        public float? TotalPrice { get { return this.TotalPriceOption; } set { this.TotalPriceOption = new(value); } }

        /// <summary>
        /// Gets or Sets additional properties
        /// </summary>
        [JsonExtensionData]
        public Dictionary<string, JsonElement> AdditionalProperties { get; } = new Dictionary<string, JsonElement>();

        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("class MixLog {\n");
            sb.Append("  Description: ").Append(Description).Append("\n");
            sb.Append("  FormulaVersionDate: ").Append(FormulaVersionDate).Append("\n");
            sb.Append("  Id: ").Append(Id).Append("\n");
            sb.Append("  MixDate: ").Append(MixDate).Append("\n");
            sb.Append("  TotalOverPoors: ").Append(TotalOverPoors).Append("\n");
            sb.Append("  TotalRecalculations: ").Append(TotalRecalculations).Append("\n");
            sb.Append("  TotalSkips: ").Append(TotalSkips).Append("\n");
            sb.Append("  TotalUnderPours: ").Append(TotalUnderPours).Append("\n");
            sb.Append("  BatchNumber: ").Append(BatchNumber).Append("\n");
            sb.Append("  BrandCode: ").Append(BrandCode).Append("\n");
            sb.Append("  BrandId: ").Append(BrandId).Append("\n");
            sb.Append("  BrandName: ").Append(BrandName).Append("\n");
            sb.Append("  CategoryCode: ").Append(CategoryCode).Append("\n");
            sb.Append("  Color: ").Append(Color).Append("\n");
            sb.Append("  ColorDescription: ").Append(ColorDescription).Append("\n");
            sb.Append("  Comment: ").Append(Comment).Append("\n");
            sb.Append("  CommercialProductCode: ").Append(CommercialProductCode).Append("\n");
            sb.Append("  Country: ").Append(Country).Append("\n");
            sb.Append("  CreatedBy: ").Append(CreatedBy).Append("\n");
            sb.Append("  CreatedByFirstName: ").Append(CreatedByFirstName).Append("\n");
            sb.Append("  CreatedByLastName: ").Append(CreatedByLastName).Append("\n");
            sb.Append("  DeltaECalculationRepaired: ").Append(DeltaECalculationRepaired).Append("\n");
            sb.Append("  DeltaECalculationSprayout: ").Append(DeltaECalculationSprayout).Append("\n");
            sb.Append("  OwnColorVariantNumber: ").Append(OwnColorVariantNumber).Append("\n");
            sb.Append("  PrimerProductId: ").Append(PrimerProductId).Append("\n");
            sb.Append("  ProductId: ").Append(ProductId).Append("\n");
            sb.Append("  ProductLineCode: ").Append(ProductLineCode).Append("\n");
            sb.Append("  ProductName: ").Append(ProductName).Append("\n");
            sb.Append("  SelectedVersionIndex: ").Append(SelectedVersionIndex).Append("\n");
            sb.Append("  ShopId: ").Append(ShopId).Append("\n");
            sb.Append("  SomeCode: ").Append(SomeCode).Append("\n");
            sb.Append("  TotalPrice: ").Append(TotalPrice).Append("\n");
            sb.Append("  AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
            sb.Append("}\n");
            return sb.ToString();
        }

        /// <summary>
        /// To validate all properties of the instance
        /// </summary>
        /// <param name="validationContext">Validation context</param>
        /// <returns>Validation Result</returns>
        IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
        {
            yield break;
        }
    }

    /// <summary>
    /// A Json converter for type <see cref="MixLog" />
    /// </summary>
    public class MixLogJsonConverter : JsonConverter<MixLog>
    {
        /// <summary>
        /// The format to use to serialize FormulaVersionDate
        /// </summary>
        public static string FormulaVersionDateFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK";

        /// <summary>
        /// The format to use to serialize MixDate
        /// </summary>
        public static string MixDateFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK";

        /// <summary>
        /// Deserializes json to <see cref="MixLog" />
        /// </summary>
        /// <param name="utf8JsonReader"></param>
        /// <param name="typeToConvert"></param>
        /// <param name="jsonSerializerOptions"></param>
        /// <returns></returns>
        /// <exception cref="JsonException"></exception>
        public override MixLog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
        {
            int currentDepth = utf8JsonReader.CurrentDepth;

            if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
                throw new JsonException();

            JsonTokenType startingTokenType = utf8JsonReader.TokenType;

            Option<string> description = default;
            Option<DateTime?> formulaVersionDate = default;
            Option<Guid?> id = default;
            Option<DateTime?> mixDate = default;
            Option<int?> totalOverPoors = default;
            Option<int?> totalRecalculations = default;
            Option<int?> totalSkips = default;
            Option<int?> totalUnderPours = default;
            Option<string> batchNumber = default;
            Option<string> brandCode = default;
            Option<string> brandId = default;
            Option<string> brandName = default;
            Option<string> categoryCode = default;
            Option<string> color = default;
            Option<string> colorDescription = default;
            Option<string> comment = default;
            Option<string> commercialProductCode = default;
            Option<string> country = default;
            Option<string> createdBy = default;
            Option<string> createdByFirstName = default;
            Option<string> createdByLastName = default;
            Option<string> deltaECalculationRepaired = default;
            Option<string> deltaECalculationSprayout = default;
            Option<int?> ownColorVariantNumber = default;
            Option<string> primerProductId = default;
            Option<string> productId = default;
            Option<string> productLineCode = default;
            Option<string> productName = default;
            Option<int?> selectedVersionIndex = default;
            Option<Guid?> shopId = default;
            Option<string> someCode = default;
            Option<float?> totalPrice = default;

            while (utf8JsonReader.Read())
            {
                if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
                    break;

                if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
                    break;

                if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
                {
                    string localVarJsonPropertyName = utf8JsonReader.GetString();
                    utf8JsonReader.Read();

                    switch (localVarJsonPropertyName)
                    {
                        case "description":
                            description = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "formulaVersionDate":
                            if (utf8JsonReader.TokenType != JsonTokenType.Null)
                                formulaVersionDate = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime>(ref utf8JsonReader, jsonSerializerOptions));
                            break;
                        case "id":
                            if (utf8JsonReader.TokenType != JsonTokenType.Null)
                                id = new Option<Guid?>(utf8JsonReader.GetGuid());
                            break;
                        case "mixDate":
                            if (utf8JsonReader.TokenType != JsonTokenType.Null)
                                mixDate = new Option<DateTime?>(JsonSerializer.Deserialize<DateTime>(ref utf8JsonReader, jsonSerializerOptions));
                            break;
                        case "totalOverPoors":
                            if (utf8JsonReader.TokenType != JsonTokenType.Null)
                                totalOverPoors = new Option<int?>(utf8JsonReader.GetInt32());
                            break;
                        case "totalRecalculations":
                            if (utf8JsonReader.TokenType != JsonTokenType.Null)
                                totalRecalculations = new Option<int?>(utf8JsonReader.GetInt32());
                            break;
                        case "totalSkips":
                            if (utf8JsonReader.TokenType != JsonTokenType.Null)
                                totalSkips = new Option<int?>(utf8JsonReader.GetInt32());
                            break;
                        case "totalUnderPours":
                            if (utf8JsonReader.TokenType != JsonTokenType.Null)
                                totalUnderPours = new Option<int?>(utf8JsonReader.GetInt32());
                            break;
                        case "batchNumber":
                            batchNumber = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "brandCode":
                            brandCode = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "brandId":
                            brandId = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "brandName":
                            brandName = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "categoryCode":
                            categoryCode = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "color":
                            color = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "colorDescription":
                            colorDescription = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "comment":
                            comment = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "commercialProductCode":
                            commercialProductCode = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "country":
                            country = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "createdBy":
                            createdBy = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "createdByFirstName":
                            createdByFirstName = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "createdByLastName":
                            createdByLastName = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "deltaECalculationRepaired":
                            deltaECalculationRepaired = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "deltaECalculationSprayout":
                            deltaECalculationSprayout = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "ownColorVariantNumber":
                            if (utf8JsonReader.TokenType != JsonTokenType.Null)
                                ownColorVariantNumber = new Option<int?>(utf8JsonReader.GetInt32());
                            break;
                        case "primerProductId":
                            primerProductId = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "productId":
                            productId = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "productLineCode":
                            productLineCode = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "productName":
                            productName = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "selectedVersionIndex":
                            if (utf8JsonReader.TokenType != JsonTokenType.Null)
                                selectedVersionIndex = new Option<int?>(utf8JsonReader.GetInt32());
                            break;
                        case "shopId":
                            if (utf8JsonReader.TokenType != JsonTokenType.Null)
                                shopId = new Option<Guid?>(utf8JsonReader.GetGuid());
                            break;
                        case "someCode":
                            someCode = new Option<string>(utf8JsonReader.GetString());
                            break;
                        case "totalPrice":
                            if (utf8JsonReader.TokenType != JsonTokenType.Null)
                                totalPrice = new Option<float?>((float)utf8JsonReader.GetDouble());
                            break;
                        default:
                            break;
                    }
                }
            }

            if (!description.IsSet)
                throw new ArgumentException("Property is required for class MixLog.", nameof(description));

            if (!formulaVersionDate.IsSet)
                throw new ArgumentException("Property is required for class MixLog.", nameof(formulaVersionDate));

            if (!id.IsSet)
                throw new ArgumentException("Property is required for class MixLog.", nameof(id));

            if (!mixDate.IsSet)
                throw new ArgumentException("Property is required for class MixLog.", nameof(mixDate));

            if (!totalOverPoors.IsSet)
                throw new ArgumentException("Property is required for class MixLog.", nameof(totalOverPoors));

            if (!totalRecalculations.IsSet)
                throw new ArgumentException("Property is required for class MixLog.", nameof(totalRecalculations));

            if (!totalSkips.IsSet)
                throw new ArgumentException("Property is required for class MixLog.", nameof(totalSkips));

            if (!totalUnderPours.IsSet)
                throw new ArgumentException("Property is required for class MixLog.", nameof(totalUnderPours));

            if (description.IsSet && description.Value == null)
                throw new ArgumentNullException(nameof(description), "Property is not nullable for class MixLog.");

            if (formulaVersionDate.IsSet && formulaVersionDate.Value == null)
                throw new ArgumentNullException(nameof(formulaVersionDate), "Property is not nullable for class MixLog.");

            if (id.IsSet && id.Value == null)
                throw new ArgumentNullException(nameof(id), "Property is not nullable for class MixLog.");

            if (mixDate.IsSet && mixDate.Value == null)
                throw new ArgumentNullException(nameof(mixDate), "Property is not nullable for class MixLog.");

            if (totalOverPoors.IsSet && totalOverPoors.Value == null)
                throw new ArgumentNullException(nameof(totalOverPoors), "Property is not nullable for class MixLog.");

            if (totalRecalculations.IsSet && totalRecalculations.Value == null)
                throw new ArgumentNullException(nameof(totalRecalculations), "Property is not nullable for class MixLog.");

            if (totalSkips.IsSet && totalSkips.Value == null)
                throw new ArgumentNullException(nameof(totalSkips), "Property is not nullable for class MixLog.");

            if (totalUnderPours.IsSet && totalUnderPours.Value == null)
                throw new ArgumentNullException(nameof(totalUnderPours), "Property is not nullable for class MixLog.");

            if (batchNumber.IsSet && batchNumber.Value == null)
                throw new ArgumentNullException(nameof(batchNumber), "Property is not nullable for class MixLog.");

            if (brandCode.IsSet && brandCode.Value == null)
                throw new ArgumentNullException(nameof(brandCode), "Property is not nullable for class MixLog.");

            if (brandId.IsSet && brandId.Value == null)
                throw new ArgumentNullException(nameof(brandId), "Property is not nullable for class MixLog.");

            if (brandName.IsSet && brandName.Value == null)
                throw new ArgumentNullException(nameof(brandName), "Property is not nullable for class MixLog.");

            if (categoryCode.IsSet && categoryCode.Value == null)
                throw new ArgumentNullException(nameof(categoryCode), "Property is not nullable for class MixLog.");

            if (color.IsSet && color.Value == null)
                throw new ArgumentNullException(nameof(color), "Property is not nullable for class MixLog.");

            if (colorDescription.IsSet && colorDescription.Value == null)
                throw new ArgumentNullException(nameof(colorDescription), "Property is not nullable for class MixLog.");

            if (comment.IsSet && comment.Value == null)
                throw new ArgumentNullException(nameof(comment), "Property is not nullable for class MixLog.");

            if (commercialProductCode.IsSet && commercialProductCode.Value == null)
                throw new ArgumentNullException(nameof(commercialProductCode), "Property is not nullable for class MixLog.");

            if (country.IsSet && country.Value == null)
                throw new ArgumentNullException(nameof(country), "Property is not nullable for class MixLog.");

            if (createdBy.IsSet && createdBy.Value == null)
                throw new ArgumentNullException(nameof(createdBy), "Property is not nullable for class MixLog.");

            if (createdByFirstName.IsSet && createdByFirstName.Value == null)
                throw new ArgumentNullException(nameof(createdByFirstName), "Property is not nullable for class MixLog.");

            if (createdByLastName.IsSet && createdByLastName.Value == null)
                throw new ArgumentNullException(nameof(createdByLastName), "Property is not nullable for class MixLog.");

            if (deltaECalculationRepaired.IsSet && deltaECalculationRepaired.Value == null)
                throw new ArgumentNullException(nameof(deltaECalculationRepaired), "Property is not nullable for class MixLog.");

            if (deltaECalculationSprayout.IsSet && deltaECalculationSprayout.Value == null)
                throw new ArgumentNullException(nameof(deltaECalculationSprayout), "Property is not nullable for class MixLog.");

            if (primerProductId.IsSet && primerProductId.Value == null)
                throw new ArgumentNullException(nameof(primerProductId), "Property is not nullable for class MixLog.");

            if (productId.IsSet && productId.Value == null)
                throw new ArgumentNullException(nameof(productId), "Property is not nullable for class MixLog.");

            if (productLineCode.IsSet && productLineCode.Value == null)
                throw new ArgumentNullException(nameof(productLineCode), "Property is not nullable for class MixLog.");

            if (productName.IsSet && productName.Value == null)
                throw new ArgumentNullException(nameof(productName), "Property is not nullable for class MixLog.");

            if (selectedVersionIndex.IsSet && selectedVersionIndex.Value == null)
                throw new ArgumentNullException(nameof(selectedVersionIndex), "Property is not nullable for class MixLog.");

            if (shopId.IsSet && shopId.Value == null)
                throw new ArgumentNullException(nameof(shopId), "Property is not nullable for class MixLog.");

            return new MixLog(description.Value, formulaVersionDate.Value.Value, id.Value.Value, mixDate.Value.Value, totalOverPoors.Value.Value, totalRecalculations.Value.Value, totalSkips.Value.Value, totalUnderPours.Value.Value, batchNumber, brandCode, brandId, brandName, categoryCode, color, colorDescription, comment, commercialProductCode, country, createdBy, createdByFirstName, createdByLastName, deltaECalculationRepaired, deltaECalculationSprayout, ownColorVariantNumber, primerProductId, productId, productLineCode, productName, selectedVersionIndex, shopId, someCode, totalPrice);
        }

        /// <summary>
        /// Serializes a <see cref="MixLog" />
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="mixLog"></param>
        /// <param name="jsonSerializerOptions"></param>
        /// <exception cref="NotImplementedException"></exception>
        public override void Write(Utf8JsonWriter writer, MixLog mixLog, JsonSerializerOptions jsonSerializerOptions)
        {
            writer.WriteStartObject();

            WriteProperties(ref writer, mixLog, jsonSerializerOptions);
            writer.WriteEndObject();
        }

        /// <summary>
        /// Serializes the properties of <see cref="MixLog" />
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="mixLog"></param>
        /// <param name="jsonSerializerOptions"></param>
        /// <exception cref="NotImplementedException"></exception>
        public void WriteProperties(ref Utf8JsonWriter writer, MixLog mixLog, JsonSerializerOptions jsonSerializerOptions)
        {
            if (mixLog.Description == null)
                throw new ArgumentNullException(nameof(mixLog.Description), "Property is required for class MixLog.");

            if (mixLog.BatchNumberOption.IsSet && mixLog.BatchNumber == null)
                throw new ArgumentNullException(nameof(mixLog.BatchNumber), "Property is required for class MixLog.");

            if (mixLog.BrandCodeOption.IsSet && mixLog.BrandCode == null)
                throw new ArgumentNullException(nameof(mixLog.BrandCode), "Property is required for class MixLog.");

            if (mixLog.BrandIdOption.IsSet && mixLog.BrandId == null)
                throw new ArgumentNullException(nameof(mixLog.BrandId), "Property is required for class MixLog.");

            if (mixLog.BrandNameOption.IsSet && mixLog.BrandName == null)
                throw new ArgumentNullException(nameof(mixLog.BrandName), "Property is required for class MixLog.");

            if (mixLog.CategoryCodeOption.IsSet && mixLog.CategoryCode == null)
                throw new ArgumentNullException(nameof(mixLog.CategoryCode), "Property is required for class MixLog.");

            if (mixLog.ColorOption.IsSet && mixLog.Color == null)
                throw new ArgumentNullException(nameof(mixLog.Color), "Property is required for class MixLog.");

            if (mixLog.ColorDescriptionOption.IsSet && mixLog.ColorDescription == null)
                throw new ArgumentNullException(nameof(mixLog.ColorDescription), "Property is required for class MixLog.");

            if (mixLog.CommentOption.IsSet && mixLog.Comment == null)
                throw new ArgumentNullException(nameof(mixLog.Comment), "Property is required for class MixLog.");

            if (mixLog.CommercialProductCodeOption.IsSet && mixLog.CommercialProductCode == null)
                throw new ArgumentNullException(nameof(mixLog.CommercialProductCode), "Property is required for class MixLog.");

            if (mixLog.CountryOption.IsSet && mixLog.Country == null)
                throw new ArgumentNullException(nameof(mixLog.Country), "Property is required for class MixLog.");

            if (mixLog.CreatedByOption.IsSet && mixLog.CreatedBy == null)
                throw new ArgumentNullException(nameof(mixLog.CreatedBy), "Property is required for class MixLog.");

            if (mixLog.CreatedByFirstNameOption.IsSet && mixLog.CreatedByFirstName == null)
                throw new ArgumentNullException(nameof(mixLog.CreatedByFirstName), "Property is required for class MixLog.");

            if (mixLog.CreatedByLastNameOption.IsSet && mixLog.CreatedByLastName == null)
                throw new ArgumentNullException(nameof(mixLog.CreatedByLastName), "Property is required for class MixLog.");

            if (mixLog.DeltaECalculationRepairedOption.IsSet && mixLog.DeltaECalculationRepaired == null)
                throw new ArgumentNullException(nameof(mixLog.DeltaECalculationRepaired), "Property is required for class MixLog.");

            if (mixLog.DeltaECalculationSprayoutOption.IsSet && mixLog.DeltaECalculationSprayout == null)
                throw new ArgumentNullException(nameof(mixLog.DeltaECalculationSprayout), "Property is required for class MixLog.");

            if (mixLog.PrimerProductIdOption.IsSet && mixLog.PrimerProductId == null)
                throw new ArgumentNullException(nameof(mixLog.PrimerProductId), "Property is required for class MixLog.");

            if (mixLog.ProductIdOption.IsSet && mixLog.ProductId == null)
                throw new ArgumentNullException(nameof(mixLog.ProductId), "Property is required for class MixLog.");

            if (mixLog.ProductLineCodeOption.IsSet && mixLog.ProductLineCode == null)
                throw new ArgumentNullException(nameof(mixLog.ProductLineCode), "Property is required for class MixLog.");

            if (mixLog.ProductNameOption.IsSet && mixLog.ProductName == null)
                throw new ArgumentNullException(nameof(mixLog.ProductName), "Property is required for class MixLog.");

            writer.WriteString("description", mixLog.Description);

            writer.WriteString("formulaVersionDate", mixLog.FormulaVersionDate.ToString(FormulaVersionDateFormat));

            writer.WriteString("id", mixLog.Id);

            writer.WriteString("mixDate", mixLog.MixDate.ToString(MixDateFormat));

            writer.WriteNumber("totalOverPoors", mixLog.TotalOverPoors);

            writer.WriteNumber("totalRecalculations", mixLog.TotalRecalculations);

            writer.WriteNumber("totalSkips", mixLog.TotalSkips);

            writer.WriteNumber("totalUnderPours", mixLog.TotalUnderPours);

            if (mixLog.BatchNumberOption.IsSet)
                writer.WriteString("batchNumber", mixLog.BatchNumber);

            if (mixLog.BrandCodeOption.IsSet)
                writer.WriteString("brandCode", mixLog.BrandCode);

            if (mixLog.BrandIdOption.IsSet)
                writer.WriteString("brandId", mixLog.BrandId);

            if (mixLog.BrandNameOption.IsSet)
                writer.WriteString("brandName", mixLog.BrandName);

            if (mixLog.CategoryCodeOption.IsSet)
                writer.WriteString("categoryCode", mixLog.CategoryCode);

            if (mixLog.ColorOption.IsSet)
                writer.WriteString("color", mixLog.Color);

            if (mixLog.ColorDescriptionOption.IsSet)
                writer.WriteString("colorDescription", mixLog.ColorDescription);

            if (mixLog.CommentOption.IsSet)
                writer.WriteString("comment", mixLog.Comment);

            if (mixLog.CommercialProductCodeOption.IsSet)
                writer.WriteString("commercialProductCode", mixLog.CommercialProductCode);

            if (mixLog.CountryOption.IsSet)
                writer.WriteString("country", mixLog.Country);

            if (mixLog.CreatedByOption.IsSet)
                writer.WriteString("createdBy", mixLog.CreatedBy);

            if (mixLog.CreatedByFirstNameOption.IsSet)
                writer.WriteString("createdByFirstName", mixLog.CreatedByFirstName);

            if (mixLog.CreatedByLastNameOption.IsSet)
                writer.WriteString("createdByLastName", mixLog.CreatedByLastName);

            if (mixLog.DeltaECalculationRepairedOption.IsSet)
                writer.WriteString("deltaECalculationRepaired", mixLog.DeltaECalculationRepaired);

            if (mixLog.DeltaECalculationSprayoutOption.IsSet)
                writer.WriteString("deltaECalculationSprayout", mixLog.DeltaECalculationSprayout);

            if (mixLog.OwnColorVariantNumberOption.IsSet)
                if (mixLog.OwnColorVariantNumberOption.Value != null)
                    writer.WriteNumber("ownColorVariantNumber", mixLog.OwnColorVariantNumberOption.Value.Value);
                else
                    writer.WriteNull("ownColorVariantNumber");

            if (mixLog.PrimerProductIdOption.IsSet)
                writer.WriteString("primerProductId", mixLog.PrimerProductId);

            if (mixLog.ProductIdOption.IsSet)
                writer.WriteString("productId", mixLog.ProductId);

            if (mixLog.ProductLineCodeOption.IsSet)
                writer.WriteString("productLineCode", mixLog.ProductLineCode);

            if (mixLog.ProductNameOption.IsSet)
                writer.WriteString("productName", mixLog.ProductName);

            if (mixLog.SelectedVersionIndexOption.IsSet)
                writer.WriteNumber("selectedVersionIndex", mixLog.SelectedVersionIndexOption.Value.Value);

            if (mixLog.ShopIdOption.IsSet)
                writer.WriteString("shopId", mixLog.ShopIdOption.Value.Value);

            if (mixLog.SomeCodeOption.IsSet)
                if (mixLog.SomeCodeOption.Value != null)
                    writer.WriteString("someCode", mixLog.SomeCode);
                else
                    writer.WriteNull("someCode");

            if (mixLog.TotalPriceOption.IsSet)
                if (mixLog.TotalPriceOption.Value != null)
                    writer.WriteNumber("totalPrice", mixLog.TotalPriceOption.Value.Value);
                else
                    writer.WriteNull("totalPrice");
        }
    }
}
