#![allow(dead_code)]
//! Interaction Models
//!
//! Database models for drug interactions

use mongodb::bson::{oid::ObjectId, DateTime};
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DrugInteraction {
    #[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
    pub id: Option<ObjectId>,
    #[serde(rename = "drug1")]
    pub drug1: String,
    #[serde(rename = "drug2")]
    pub drug2: String,
    #[serde(rename = "severity")]
    pub severity: InteractionSeverity,
    #[serde(rename = "description")]
    pub description: String,
    #[serde(rename = "source")]
    pub source: InteractionSource,
    #[serde(rename = "createdAt")]
    pub created_at: DateTime,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum InteractionSeverity {
    Mild,
    Moderate,
    Severe,
    Unknown,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum InteractionSource {
    OpenFDA,
    UserProvided,
    ProfessionalDatabase,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MedicationIngredient {
    #[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
    pub id: Option<ObjectId>,
    #[serde(rename = "medicationName")]
    pub medication_name: String,
    #[serde(rename = "ingredientName")]
    pub ingredient_name: String,
    #[serde(rename = "region")]
    pub region: String, // "EU" or "US"
    #[serde(rename = "createdAt")]
    pub created_at: DateTime,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UserAllergy {
    #[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
    pub id: Option<ObjectId>,
    #[serde(rename = "userId")]
    pub user_id: String,
    #[serde(rename = "allergen")]
    pub allergen: String,
    #[serde(rename = "allergyType")]
    pub allergy_type: AllergyType,
    #[serde(rename = "severity")]
    pub severity: String,
    #[serde(rename = "notes")]
    pub notes: Option<String>,
    #[serde(rename = "createdAt")]
    pub created_at: DateTime,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum AllergyType {
    Drug,
    Food,
    Environmental,
    Other,
}
