// file: kb_lib/src/db/entities/instruction_observation.rs

//! Instruction observation entity.

/// Persisted technical observation for one Solana instruction.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, sqlx::FromRow)]
pub struct InstructionObservationEntity {
    /// Internal row id.
    pub id: i64,
    /// Stable observation key.
    pub observation_key: std::string::String,
    /// Parent transaction id.
    pub transaction_id: i64,
    /// Parent transaction signature.
    pub signature: std::string::String,
    /// Optional Solana slot.
    pub slot: std::option::Option<i64>,
    /// Optional block time.
    pub block_time: std::option::Option<i64>,
    /// Transaction failed flag.
    pub failed: i64,
    /// Instruction row id.
    pub instruction_id: i64,
    /// Optional parent instruction id.
    pub parent_instruction_id: std::option::Option<i64>,
    /// Outer instruction index.
    pub instruction_index: i64,
    /// Optional inner instruction index.
    pub inner_instruction_index: std::option::Option<i64>,
    /// Instruction program id.
    pub program_id: std::string::String,
    /// Local decoder code when resolved.
    pub decoder_code: std::option::Option<std::string::String>,
    /// First eight instruction-data bytes as lower-hex.
    pub discriminator_hex: std::option::Option<std::string::String>,
    /// Known local instruction name when resolved.
    pub instruction_name: std::option::Option<std::string::String>,
    /// Accounts JSON.
    pub accounts_json: std::string::String,
    /// Optional data JSON.
    pub data_json: std::option::Option<std::string::String>,
    /// Optional pool account.
    pub pool_account: std::option::Option<std::string::String>,
    /// Optional decoded event kind.
    pub decoded_event_kind: std::option::Option<std::string::String>,
    /// Optional decoded event id.
    pub decoded_event_id: std::option::Option<i64>,
    /// First observation timestamp.
    pub observed_at: std::string::String,
    /// Last refresh timestamp.
    pub updated_at: std::string::String,
}
