/* Code generated by Azure.Iot.Operations.ProtocolCompilerLib v0.10.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::device_endpoints_schema::DeviceEndpointsSchema;

/// Represents a Device resource, modeled after the devices.namespaces.deviceregistry.microsoft.com CRD in Kubernetes.
#[derive(Serialize, Deserialize, Debug, Clone, Builder)]
pub struct Device {
    /// A set of key-value pairs that contain custom attributes set by the customer.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub attributes: Option<HashMap<String, String>>,

    /// Reference to a device. Populated only if the device had been created from discovery flow. Discovered device name must be provided.
    #[serde(rename = "discoveredDeviceRef")]
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub discovered_device_ref: Option<String>,

    /// Indicates if the resource and identity are enabled or not. A disabled device cannot authenticate with Microsoft Entra ID.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub enabled: Option<bool>,

    /// Connection endpoint url a device can use to connect to a service.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub endpoints: Option<DeviceEndpointsSchema>,

    /// The Device ID provided by the customer.
    #[serde(rename = "externalDeviceId")]
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub external_device_id: Option<String>,

    /// A timestamp (in UTC) that is updated each time the resource is modified.
    #[serde(rename = "lastTransitionTime")]
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub last_transition_time: Option<DateTime<Utc>>,

    /// Device manufacturer.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub manufacturer: Option<String>,

    /// Device model.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub model: Option<String>,

    /// Device operating system.
    #[serde(rename = "operatingSystem")]
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub operating_system: Option<String>,

    /// Device operating system version.
    #[serde(rename = "operatingSystemVersion")]
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub operating_system_version: Option<String>,

    /// Gets a unique identifier for this resource.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub uuid: Option<String>,

    /// An integer that is incremented each time the resource is modified.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default = "None")]
    pub version: Option<u64>,
}
