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

///A validated record of a user's score in the Snake game.
#[jacquard_derive::lexicon]
#[derive(
    serde::Serialize,
    serde::Deserialize,
    Debug,
    Clone,
    PartialEq,
    Eq,
    jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Score<'a> {
    ///When the score was achieved
    pub created_at: jacquard_common::types::string::Datetime,
    ///Validation proof to prevent score manipulation
    #[serde(skip_serializing_if = "std::option::Option::is_none")]
    #[serde(borrow)]
    pub game_proof: std::option::Option<ScoreRecordGameProof<'a>>,
    ///The player's final score
    pub score: i64,
}

///Validation proof to prevent score manipulation
#[jacquard_derive::lexicon]
#[derive(
    serde::Serialize,
    serde::Deserialize,
    Debug,
    Clone,
    PartialEq,
    Eq,
    jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct ScoreRecordGameProof<'a> {
    ///Number of recorded game actions
    #[serde(skip_serializing_if = "std::option::Option::is_none")]
    pub action_count: std::option::Option<i64>,
    ///Cryptographic checksum of game actions
    #[serde(skip_serializing_if = "std::option::Option::is_none")]
    #[serde(borrow)]
    pub checksum: std::option::Option<jacquard_common::CowStr<'a>>,
    ///Game duration in milliseconds
    #[serde(skip_serializing_if = "std::option::Option::is_none")]
    pub duration: std::option::Option<i64>,
}

impl jacquard_common::types::collection::Collection for Score<'_> {
    const NSID: &'static str = "uk.ewancroft.snake.score";
}