/* 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.Host.Generated.Common;

namespace Azure.Iot.Operations.Services.EdgeRegistry.Host.Generated
{
    /// <summary>
    /// Request payload for creating a Thing Description Version.
    /// </summary>
    [System.CodeDom.Compiler.GeneratedCode("Azure.Iot.Operations.ProtocolCompilerLib", "1.0.0.0")]
    public partial class CreateThingDescriptionVersionAttributes : IJsonOnDeserialized, IJsonOnSerializing
    {
        /// <summary>
        /// Group identifier. Uses the default if not specified.
        /// </summary>
        [JsonPropertyName("groupId")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? GroupId { get; set; } = default;

        /// <summary>
        /// Human-readable name.
        /// </summary>
        [JsonPropertyName("name")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? Name { get; set; } = default;

        /// <summary>
        /// A human-readable summary of the purpose of the entity.
        /// </summary>
        [JsonPropertyName("description")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? Description { get; set; } = default;

        /// <summary>
        /// A URL to additional information about this entity.
        /// </summary>
        [JsonPropertyName("documentation")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? Documentation { get; set; } = default;

        /// <summary>
        /// A URL to a graphical icon for the owning entity.
        /// </summary>
        [JsonPropertyName("icon")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? Icon { get; set; } = default;

        /// <summary>
        /// Queryable Key Value pairs to be added to the Version. Labels can be used to store additional metadata about the Version.
        /// </summary>
        [JsonPropertyName("labels")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public List<Label> Labels { get; set; } = default!;

        /// <summary>
        /// The versionId of this Version's ancestor if it has an ancestor.
        /// </summary>
        [JsonPropertyName("ancestor")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public ulong? Ancestor { get; set; } = default;

        /// <summary>
        /// The media type of the entity as defined by RFC9110.
        /// </summary>
        [JsonPropertyName("contentType")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? ContentType { get; set; } = default;

        /// <summary>
        /// Thing Description format identifier.
        /// </summary>
        [JsonPropertyName("format")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public string Format { get; set; } = default!;

        /// <summary>
        /// Base64-encoded thing description document content.
        /// </summary>
        [JsonPropertyName("document")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public byte[] Document { get; set; } = default!;

        /// <summary>
        /// Extension-specific attributes.
        /// </summary>
        [JsonPropertyName("extensions")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public Dictionary<string, byte[]> Extensions { get; set; } = default!;

        /// <summary>
        /// Queryable Key Value pairs to be added to the parent Thing Description. Labels can be used to store additional metadata about the Thing Description.
        /// </summary>
        [JsonPropertyName("thingDescriptionLabels")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public List<Label> ThingDescriptionLabels { get; set; } = default!;

        void IJsonOnDeserialized.OnDeserialized()
        {
            if (Labels is null)
            {
                throw new ArgumentNullException("labels field cannot be null");
            }
            if (Format is null)
            {
                throw new ArgumentNullException("format field cannot be null");
            }
            if (Document is null)
            {
                throw new ArgumentNullException("document field cannot be null");
            }
            if (Extensions is null)
            {
                throw new ArgumentNullException("extensions field cannot be null");
            }
            if (ThingDescriptionLabels is null)
            {
                throw new ArgumentNullException("thingDescriptionLabels field cannot be null");
            }
        }

        void IJsonOnSerializing.OnSerializing()
        {
            if (Labels is null)
            {
                throw new ArgumentNullException("labels field cannot be null");
            }
            if (Format is null)
            {
                throw new ArgumentNullException("format field cannot be null");
            }
            if (Document is null)
            {
                throw new ArgumentNullException("document field cannot be null");
            }
            if (Extensions is null)
            {
                throw new ArgumentNullException("extensions field cannot be null");
            }
            if (ThingDescriptionLabels is null)
            {
                throw new ArgumentNullException("thingDescriptionLabels field cannot be null");
            }
        }
    }
}
