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

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Vault {
    pub id: RecordId,
    pub name: String,
    pub user_id: RecordId,
    pub description: Option<String>,
    pub beneficiary_ids: Vec<RecordId>,
    pub jot_ids: Vec<RecordId>,
    pub trigger_config: Option<VaultTriggerConfig>,
    pub effective_trigger_at: Option<DateTime<Utc>>,
    pub status: VaultStatus,
    pub created_at: DateTime<Utc>,
    pub updated_at: DateTime<Utc>,
    pub version: i32,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct VaultTriggerConfig {
    pub r#type: VaultTriggerType,
    pub inactivity_duration_days: Option<i64>, 
    pub fixed_date: Option<DateTime<Utc>>,
    pub notification_delay_days: Option<i64>,
    pub notification_delay_hours: Option<i64>,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum VaultTriggerType {
    FixedDate,
    Inactivity,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum VaultStatus {
    Active,
    Released,
    Archived, 
}
