// 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 Sourcereferencesitem {
    #[serde(rename = "sourceSystemUri")]
    pub source_system_uri: String,
    #[serde(rename = "sourceRecordId")]
    pub source_record_id: String,
    #[serde(rename = "sourceUrl")]
    pub source_url: Option<String>,
}

/// Defines a verifiable legal or functional relationship between two or more attested entities. Supports bilateral contracts, n-ary memberships, fiscal sponsorships, and hierarchical compositions. CEP Relationships are designed to interoperate with existing open civic standards (Popolo Membership/Post, Open Civic Data organizations and jurisdictions, Open Contracting Data Standard awards/contracts, Schema.org Grant/MonetaryGrant, HSDS funding relationships) via recordTypeUri, roleUri, and sourceReferences.

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

    #[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 = "bilateralParties")]
    pub bilateral_parties: Option<serde_json::Value>,

    #[serde(rename = "multilateralMembers")]
    pub multilateral_members: Option<Vec<serde_json::Value>>,

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

    #[serde(rename = "effectiveTimestamp")]
    pub effective_timestamp: String,

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

    #[serde(rename = "financialTerms")]
    pub financial_terms: Option<serde_json::Value>,

    #[serde(rename = "termsAttributes")]
    pub terms_attributes: Option<serde_json::Value>,

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

    #[serde(rename = "sourceReferences")]
    pub source_references: Option<Vec<Sourcereferencesitem>>,

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