/* Code generated by Azure.Iot.Operations.ProtocolCompilerLib v1.0.0.0; DO NOT EDIT. */
#![allow(unused_imports)]

use std::collections::HashMap;

use chrono::{DateTime, Utc};
use derive_builder::Builder;
use iso8601_duration::Duration;
use serde::{Deserialize, Serialize};
use uuid::Uuid;

use super::super::common_types::{b64::Bytes, date_only::Date, decimal::Decimal, time_only::Time};
use super::label::Label;
use super::validation_status::ValidationStatus;

/// A specific Version of a Thing Description. Self-contained: combines the generic Version fields and the thing description-specific fields into one schema, with integer-typed versionId and ancestor.
#[derive(Serialize, Deserialize, Debug, Clone, Builder)]
pub struct ThingDescriptionVersion {
    /// Thing Description (Resource) identifier.
    #[serde(rename = "resourceId")]
    pub resource_id: String,

    /// Version identifier.
    #[serde(rename = "versionId")]
    pub version_id: u64,

    /// The versionId of this Version's ancestor, or this Version's versionId if it has no ancestor.
    pub ancestor: u64,

    /// Thing Description format identifier.
    pub format: String,

    /// The raw thing description document for this Version as base64-encoded bytes.
    pub document: Bytes,

    /// The hash of the thing description document for this Version.
    #[serde(rename = "documentHash")]
    pub document_hash: String,

    /// Full XID path.
    pub xid: String,

    /// A numeric value used to determine whether an entity has been modified.
    pub epoch: u64,

    /// Human-readable name.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub name: Option<String>,

    /// Indicates whether this Version is the default Version of the owning Resource.
    #[serde(rename = "isDefault")]
    pub is_default: bool,

    /// A human-readable summary of the purpose of the entity.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub description: Option<String>,

    /// A URL to additional information about this entity.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub documentation: Option<String>,

    /// A URL to a graphical icon for the owning entity.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub icon: Option<String>,

    /// A mechanism in which additional metadata about the entity can be stored without changing the model definition of the entity. Labels can be used for querying.
    #[builder(default)]
    pub labels: Vec<Label>,

    /// The date/time of when the entity was created.
    #[serde(rename = "createdAt")]
    pub created_at: DateTime<Utc>,

    /// The date/time of when the entity was last updated.
    #[serde(rename = "modifiedAt")]
    pub modified_at: DateTime<Utc>,

    /// The media type of the entity as defined by RFC9110.
    #[serde(rename = "contentType")]
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub content_type: Option<String>,

    /// When format validation is enabled, indicates whether the server has validated that the Version conforms to the rules defined by its `format` attribute.
    #[serde(rename = "formatValidated")]
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub format_validated: Option<ValidationStatus>,

    /// When compatibility validation is enabled, indicates whether the server has validated that the Version conforms to the rules defined by its Resource's `meta.compatibility` attribute.
    #[serde(rename = "compatibilityValidated")]
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub compatibility_validated: Option<ValidationStatus>,

    /// Extension-specific attributes.
    #[builder(default)]
    pub extensions: HashMap<String, Bytes>,
}
