use serde::{Deserialize, Serialize};
use solana_sdk::pubkey::Pubkey;
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "PascalCase")]
#[repr(u8)]
pub enum ActionType {
Transaction = 0,
Decision = 1,
ModelInvocation = 2,
ToolCall = 3,
ResourceAccess = 4,
PolicyCheck = 5,
Custom = 6,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AttestationPayload {
pub action_type: ActionType,
pub payload: serde_json::Value,
pub metadata: Option<serde_json::Value>,
}
#[derive(Debug, Clone)]
pub struct AttestResult {
pub tx_signature: String,
pub explorer_url: String,
}
#[derive(Debug, Clone)]
pub struct RegisterAgentResult {
pub tx_signature: String,
pub agent_pda: Pubkey,
pub explorer_url: String,
}
#[derive(Debug, Clone)]
pub struct AgentAccount {
pub address: Pubkey,
pub operator: Pubkey,
pub agent_id: [u8; 32],
pub policy_root: [u8; 32],
pub attestation_count: u64,
pub created_at: i64,
pub revoked: bool,
pub bump: u8,
}
#[derive(Debug, Clone)]
pub struct AttestParams {
pub action_hash: [u8; 32],
pub action_type: ActionType,
pub privacy_mode: bool,
}
#[derive(Debug, Clone)]
pub struct ProvaConfig {
pub rpc_url: String,
pub program_id: Option<String>,
}
impl Default for ProvaConfig {
fn default() -> Self {
Self {
rpc_url: "https://api.devnet.solana.com".to_string(),
program_id: None,
}
}
}
pub type AttestationResult = AttestResult;
#[derive(Debug, Clone)]
pub struct VerifyResult {
pub valid: bool,
pub error: Option<String>,
}
#[derive(Debug, Clone)]
pub struct HistoryQuery {
pub agent_id: String,
pub from_timestamp: Option<u64>,
pub to_timestamp: Option<u64>,
pub action_type: Option<ActionType>,
pub limit: Option<usize>,
pub offset: Option<usize>,
}