// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: network.cosmik.defs
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

pub mod card;
pub mod collection;
pub mod collection_link;
pub mod collection_link_removal;
pub mod connection;
pub mod follow;


#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::com_atproto::repo::strong_ref::StrongRef;
/// Represents the provenance or source of a record.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct Provenance<'a> {
    ///Strong reference to the card that led to this record.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub via: Option<StrongRef<'a>>,
}

impl<'a> LexiconSchema for Provenance<'a> {
    fn nsid() -> &'static str {
        "network.cosmik.defs"
    }
    fn def_name() -> &'static str {
        "provenance"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_network_cosmik_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

fn lexicon_doc_network_cosmik_defs() -> LexiconDoc<'static> {
    #[allow(unused_imports)]
    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
    use jacquard_lexicon::lexicon::*;
    use alloc::collections::BTreeMap;
    LexiconDoc {
        lexicon: Lexicon::Lexicon1,
        id: CowStr::new_static("network.cosmik.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("provenance"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Represents the provenance or source of a record.",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("via"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}