/* 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::deprecated_info::DeprecatedInfo;
use super::label::Label;

#[derive(Serialize, Deserialize, Debug, Clone, Builder)]
pub struct ResourceMeta {
    /// Resource identifier.
    pub id: String,

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

    /// Indicates that this Resource is a reference to another Resource within the same Registry. The XID path of the referenced Resource.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub xref: Option<String>,

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

    /// 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>,

    /// Indicates whether the Resource is updateable by clients.
    #[serde(rename = "readOnly")]
    pub read_only: bool,

    /// States that Versions of this Resource adhere to a certain compatibility rule.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub compatibility: Option<String>,

    /// Information about deprecation status of the entity, if applicable.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub deprecated: Option<DeprecatedInfo>,

    /// The versionId of the default Version of the Resource.
    #[serde(rename = "defaultVersionId")]
    pub default_version_id: String,

    /// A value of true means that `defaultVersionId` has been explicitly set and MUST NOT automatically change if other Versions are added or removed. A value of false means the default Version MUST be the newest Version, as defined by the Resource's versionmode algorithm.
    #[serde(rename = "defaultVersionSticky")]
    pub default_version_sticky: bool,

    /// Extension-specific attributes (e.g., `format` and `content_type` for schemas).
    #[builder(default)]
    pub extensions: HashMap<String, Bytes>,
}
