//! `SeaORM` Entity, manually maintained

use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "notification_deliveries")]
pub struct Model {
    pub created_at: DateTimeWithTimeZone,
    pub updated_at: DateTimeWithTimeZone,
    #[sea_orm(primary_key)]
    pub id: i32,
    pub subscription_id: Option<i32>,
    pub channel_type: String,
    pub target: String,
    pub event_type: String,
    pub status: String,
    pub provider: Option<String>,
    #[sea_orm(column_type = "Text", nullable)]
    pub response_text: Option<String>,
    #[sea_orm(column_type = "JsonBinary", nullable)]
    pub payload: Option<Json>,
    pub attempts_count: i32,
    pub next_retry_at: Option<String>,
    pub last_attempt_at: Option<String>,
    pub delivered_at: Option<String>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {}
