/* Code generated by Azure.Iot.Operations.ProtocolCompilerLib v1.0.0.0; DO NOT EDIT. */

#nullable enable

using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using Azure.Iot.Operations.Services.EdgeRegistry.Generated.Common;

namespace Azure.Iot.Operations.Services.EdgeRegistry.Generated
{
    /// <summary>
    /// The XID components that identify a Schema Version.
    /// </summary>
    [System.CodeDom.Compiler.GeneratedCode("Azure.Iot.Operations.ProtocolCompilerLib", "1.0.0.0")]
    public partial class SchemaVersionXid : IJsonOnDeserialized, IJsonOnSerializing
    {
        /// <summary>
        /// Group type.
        /// </summary>
        [JsonPropertyName("groupType")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public string GroupType { get; set; } = default!;

        /// <summary>
        /// Group identifier.
        /// </summary>
        [JsonPropertyName("groupId")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public string GroupId { get; set; } = default!;

        /// <summary>
        /// Resource type.
        /// </summary>
        [JsonPropertyName("resourceType")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public string ResourceType { get; set; } = default!;

        /// <summary>
        /// Resource identifier.
        /// </summary>
        [JsonPropertyName("resourceId")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public string ResourceId { get; set; } = default!;

        /// <summary>
        /// Version identifier.
        /// </summary>
        [JsonPropertyName("versionId")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public ulong VersionId { get; set; } = default!;

        void IJsonOnDeserialized.OnDeserialized()
        {
            if (GroupType is null)
            {
                throw new ArgumentNullException("groupType field cannot be null");
            }
            if (GroupId is null)
            {
                throw new ArgumentNullException("groupId field cannot be null");
            }
            if (ResourceType is null)
            {
                throw new ArgumentNullException("resourceType field cannot be null");
            }
            if (ResourceId is null)
            {
                throw new ArgumentNullException("resourceId field cannot be null");
            }
        }

        void IJsonOnSerializing.OnSerializing()
        {
            if (GroupType is null)
            {
                throw new ArgumentNullException("groupType field cannot be null");
            }
            if (GroupId is null)
            {
                throw new ArgumentNullException("groupId field cannot be null");
            }
            if (ResourceType is null)
            {
                throw new ArgumentNullException("resourceType field cannot be null");
            }
            if (ResourceId is null)
            {
                throw new ArgumentNullException("resourceId field cannot be null");
            }
        }
    }
}
