// <auto-generated/>
#pragma warning disable CS0618
using Microsoft.Kiota.Abstractions.Extensions;
using Microsoft.Kiota.Abstractions.Serialization;
using System.Collections.Generic;
using System.IO;
using System;
namespace Marechai.App.Models
{
    [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
    #pragma warning disable CS1591
    public partial class ScreenByMachineDto : IAdditionalDataHolder, IParsable
    #pragma warning restore CS1591
    {
        /// <summary>Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.</summary>
        public IDictionary<string, object> AdditionalData { get; set; }
        /// <summary>The id property</summary>
        public long? Id { get; set; }
        /// <summary>The machine_id property</summary>
        public int? MachineId { get; set; }
        /// <summary>The screen property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
        public global::Marechai.App.Models.ScreenByMachineDto.ScreenByMachineDto_screen? Screen { get; set; }
#nullable restore
#else
        public global::Marechai.App.Models.ScreenByMachineDto.ScreenByMachineDto_screen Screen { get; set; }
#endif
        /// <summary>The screen_id property</summary>
        public int? ScreenId { get; set; }
        /// <summary>
        /// Instantiates a new <see cref="global::Marechai.App.Models.ScreenByMachineDto"/> and sets the default values.
        /// </summary>
        public ScreenByMachineDto()
        {
            AdditionalData = new Dictionary<string, object>();
        }
        /// <summary>
        /// Creates a new instance of the appropriate class based on discriminator value
        /// </summary>
        /// <returns>A <see cref="global::Marechai.App.Models.ScreenByMachineDto"/></returns>
        /// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
        public static global::Marechai.App.Models.ScreenByMachineDto CreateFromDiscriminatorValue(IParseNode parseNode)
        {
            if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode));
            return new global::Marechai.App.Models.ScreenByMachineDto();
        }
        /// <summary>
        /// The deserialization information for the current model
        /// </summary>
        /// <returns>A IDictionary&lt;string, Action&lt;IParseNode&gt;&gt;</returns>
        public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
        {
            return new Dictionary<string, Action<IParseNode>>
            {
                { "id", n => { Id = n.GetLongValue(); } },
                { "machine_id", n => { MachineId = n.GetIntValue(); } },
                { "screen", n => { Screen = n.GetObjectValue<global::Marechai.App.Models.ScreenByMachineDto.ScreenByMachineDto_screen>(global::Marechai.App.Models.ScreenByMachineDto.ScreenByMachineDto_screen.CreateFromDiscriminatorValue); } },
                { "screen_id", n => { ScreenId = n.GetIntValue(); } },
            };
        }
        /// <summary>
        /// Serializes information the current object
        /// </summary>
        /// <param name="writer">Serialization writer to use to serialize this model</param>
        public virtual void Serialize(ISerializationWriter writer)
        {
            if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer));
            writer.WriteLongValue("id", Id);
            writer.WriteIntValue("machine_id", MachineId);
            writer.WriteObjectValue<global::Marechai.App.Models.ScreenByMachineDto.ScreenByMachineDto_screen>("screen", Screen);
            writer.WriteIntValue("screen_id", ScreenId);
            writer.WriteAdditionalData(AdditionalData);
        }
        /// <summary>
        /// Composed type wrapper for classes <see cref="global::Marechai.App.Models.ScreenByMachineDto_screenMember1"/>, <see cref="global::Marechai.App.Models.ScreenDto"/>
        /// </summary>
        [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
        public partial class ScreenByMachineDto_screen : IComposedTypeWrapper, IParsable
        {
            /// <summary>Composed type representation for type <see cref="global::Marechai.App.Models.ScreenByMachineDto_screenMember1"/></summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
            public global::Marechai.App.Models.ScreenByMachineDto_screenMember1? ScreenByMachineDtoScreenMember1 { get; set; }
#nullable restore
#else
            public global::Marechai.App.Models.ScreenByMachineDto_screenMember1 ScreenByMachineDtoScreenMember1 { get; set; }
#endif
            /// <summary>Composed type representation for type <see cref="global::Marechai.App.Models.ScreenDto"/></summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
            public global::Marechai.App.Models.ScreenDto? ScreenDto { get; set; }
#nullable restore
#else
            public global::Marechai.App.Models.ScreenDto ScreenDto { get; set; }
#endif
            /// <summary>
            /// Creates a new instance of the appropriate class based on discriminator value
            /// </summary>
            /// <returns>A <see cref="global::Marechai.App.Models.ScreenByMachineDto.ScreenByMachineDto_screen"/></returns>
            /// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
            public static global::Marechai.App.Models.ScreenByMachineDto.ScreenByMachineDto_screen CreateFromDiscriminatorValue(IParseNode parseNode)
            {
                if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode));
                var mappingValue = parseNode.GetChildNode("")?.GetStringValue();
                var result = new global::Marechai.App.Models.ScreenByMachineDto.ScreenByMachineDto_screen();
                if("".Equals(mappingValue, StringComparison.OrdinalIgnoreCase))
                {
                    result.ScreenByMachineDtoScreenMember1 = new global::Marechai.App.Models.ScreenByMachineDto_screenMember1();
                }
                else if("ScreenDto".Equals(mappingValue, StringComparison.OrdinalIgnoreCase))
                {
                    result.ScreenDto = new global::Marechai.App.Models.ScreenDto();
                }
                return result;
            }
            /// <summary>
            /// The deserialization information for the current model
            /// </summary>
            /// <returns>A IDictionary&lt;string, Action&lt;IParseNode&gt;&gt;</returns>
            public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
            {
                if(ScreenByMachineDtoScreenMember1 != null)
                {
                    return ScreenByMachineDtoScreenMember1.GetFieldDeserializers();
                }
                else if(ScreenDto != null)
                {
                    return ScreenDto.GetFieldDeserializers();
                }
                return new Dictionary<string, Action<IParseNode>>();
            }
            /// <summary>
            /// Serializes information the current object
            /// </summary>
            /// <param name="writer">Serialization writer to use to serialize this model</param>
            public virtual void Serialize(ISerializationWriter writer)
            {
                if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer));
                if(ScreenByMachineDtoScreenMember1 != null)
                {
                    writer.WriteObjectValue<global::Marechai.App.Models.ScreenByMachineDto_screenMember1>(null, ScreenByMachineDtoScreenMember1);
                }
                else if(ScreenDto != null)
                {
                    writer.WriteObjectValue<global::Marechai.App.Models.ScreenDto>(null, ScreenDto);
                }
            }
        }
    }
}
#pragma warning restore CS0618
