use chrono::NaiveDate;
use serde::Serialize;

use crate::model::frequency::Frequency;

#[derive(Debug, sqlx::FromRow, Serialize)]
pub struct Table {
    pub id: i64,
    pub name: String,
    pub cost: i64,
    pub user: String,
    pub category_name: String,
    pub category_color: String,
    pub date: String,
    pub frequency: Frequency,
}

#[derive(Debug, sqlx::FromRow, Serialize)]
pub struct Form {
    pub id: i64,
    pub name: String,
    pub cost: i64,
    pub user_id: i64,
    pub category_id: i64,
    pub date: String,
    pub frequency: Frequency,
}

#[derive(Debug, sqlx::FromRow, Serialize)]
pub struct Stat {
    pub start_date: String,
    pub cost: i64,
    pub category_id: i64,
}

#[derive(Debug)]
pub struct Create {
    pub name: String,
    pub cost: i64,
    pub user_id: i64,
    pub category_id: i64,
    pub date: NaiveDate,
    pub frequency: Frequency,
}

#[derive(Debug)]
pub struct Update {
    pub name: String,
    pub cost: i64,
    pub user_id: i64,
    pub category_id: i64,
    pub date: NaiveDate,
}