use crate::domain::record_id::RecordId;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Beneficiary {
    pub id: RecordId,
    pub first_name: String,
    pub last_name: String,
    pub email: String,
    pub mobile: Option<String>,
    pub verification: Option<Verification>,
    pub vault_keys: Option<Vec<VaultKey>>,
    pub date_of_birth: Option<String>,
    pub encrypted_secret_key: Option<String>,
    pub user_id: String,
    pub created_at: DateTime<Utc>,
    pub updated_at: DateTime<Utc>,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Verification {
    pub rule: VerificationRule,
    pub secret_question: Option<SecretQuestion>,
    pub id_verification: Option<IdVerification>,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum VerificationRule {
    ALL,
    ANY,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SecretQuestion {
    pub question1: String,
    pub question2: String,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct IdVerification {
    pub first_name: String,
    pub last_name: String,
    pub id_type: String,
    pub date_of_birth: String,
    pub resource_url: String,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct VaultKey {
    pub vault_id: String,
    pub salt: String,
    pub nonce: String,
    pub ciphertext: String,
}
