pub mod request;
pub mod response;

use postgres_types::{FromSql, ToSql};
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
pub struct Transfer {
    pub sig: String,
    pub from_address: String,
    pub to_address: String,
    pub amount: i64,
    pub memo: Option<String>,
    pub transfer_type: TransferType,
    pub ts: i64,
    pub slot: i64,
}

#[derive(Clone, Debug, ToSql, FromSql, Deserialize, Serialize, Eq, PartialEq)]
#[postgres(name = "transfer_type")]
pub enum TransferType {
    #[postgres(name = "CLAIM")]
    #[serde(rename = "CLAIM")]
    Claim,
    #[postgres(name = "MINE")]
    #[serde(rename = "MINE")]
    Mine,
    #[postgres(name = "SPL")]
    #[serde(rename = "SPL")]
    Spl,
}

#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
pub struct Supply {
    pub sig: String,
    pub amount: i64,
    pub ts: i64,
    pub slot: i64,
}

#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
pub struct Circulating {
    pub sig: String,
    pub amount: i64,
    pub ts: i64,
    pub slot: i64,
}

#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
pub struct RewardRate {
    pub sig: String,
    pub amount: i64,
    pub ts: i64,
    pub slot: i64,
}

#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
pub struct Difficulty {
    pub sig: String,
    pub value: i64,
    pub ts: i64,
    pub slot: i64,
}
