// This file is auto-generated from JSON Schema.
// Do not edit this file by hand. Regenerate via the CLI.

#![allow(clippy::all)]
#![allow(dead_code)]

use serde::{Deserialize, Serialize};


#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum RecordKind {
    #[serde(rename = "entity")]
    Entity,
    #[serde(rename = "relationship")]
    Relationship,
    #[serde(rename = "exchange")]
    Exchange,
    #[serde(rename = "p3tag")]
    P3tag,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum StatusCode {
    #[serde(rename = "ACTIVE")]
    Active,
    #[serde(rename = "INACTIVE")]
    Inactive,
    #[serde(rename = "DEPRECATED")]
    Deprecated,
    #[serde(rename = "PENDING")]
    Pending,
}

/// Lifecycle status of the record.

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct StatusEnvelope {

    #[serde(rename = "statusCode")]
    pub status_code: StatusCode,

    #[serde(rename = "statusReason")]
    pub status_reason: Option<String>,

    #[serde(rename = "statusEffectiveDate")]
    pub status_effective_date: String,
}

/// Shared timestamps for record lifecycle and validity.

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Timestamps {

    #[serde(rename = "firstSeenAt")]
    pub first_seen_at: String,

    #[serde(rename = "lastUpdatedAt")]
    pub last_updated_at: String,

    #[serde(rename = "validFrom")]
    pub valid_from: String,

    #[serde(rename = "validTo")]
    pub valid_to: Option<String>,
}

/// Evidence about who asserted these facts and how.

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Attestation {

    #[serde(rename = "attestationTimestamp")]
    pub attestation_timestamp: String,

    #[serde(rename = "attestorId")]
    pub attestor_id: String,

    #[serde(rename = "verificationMethodUri")]
    pub verification_method_uri: String,

    #[serde(rename = "proofType")]
    pub proof_type: String,

    #[serde(rename = "proofPurpose")]
    pub proof_purpose: String,

    #[serde(rename = "proofValue")]
    pub proof_value: Option<String>,

    #[serde(rename = "sourceSystem")]
    pub source_system: Option<String>,

    #[serde(rename = "sourceReference")]
    pub source_reference: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Identifier {
    #[serde(rename = "schemeUri")]
    pub scheme_uri: String,
    pub identifier: String,
    #[serde(rename = "sourceReference", skip_serializing_if = "Option::is_none")]
    pub source_reference: Option<String>,
}

pub type Identifiers = Vec<Identifier>;


/// Record describing an entity (organization, person, district, etc.) in CEP.

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EntityRecord {

    #[serde(rename = "recordKind")]
    pub record_kind: RecordKind,

    #[serde(rename = "recordSchemaUri")]
    pub record_schema_uri: String,

    #[serde(rename = "schemaVersion")]
    pub schema_version: String,

    #[serde(rename = "revisionNumber")]
    pub revision_number: i64,

    #[serde(rename = "verifiableId")]
    pub verifiable_id: String,

    #[serde(rename = "recordTypeUri")]
    pub record_type_uri: String,

    pub status: StatusEnvelope,

    pub timestamps: Timestamps,

    pub attestations: Vec<Attestation>,

    pub ctags: Option<Vec<serde_json::Value>>,

    #[serde(rename = "jurisdictionIso")]
    pub jurisdiction_iso: String,

    #[serde(rename = "legalName")]
    pub legal_name: String,

    #[serde(rename = "legalNameNormalized")]
    pub legal_name_normalized: Option<String>,

    #[serde(rename = "shortName")]
    pub short_name: Option<String>,

    pub identifiers: Option<Identifiers>,

    #[serde(rename = "inceptionDate")]
    pub inception_date: Option<String>,

    #[serde(rename = "dissolutionDate")]
    pub dissolution_date: Option<String>,

    #[serde(rename = "statusTerminationDate")]
    pub status_termination_date: Option<String>,

    #[serde(rename = "successorEntityId")]
    pub successor_entity_id: Option<String>,
}
