use diesel::prelude::*;

use super::schema::messages;

#[derive(Queryable, Selectable)]
#[diesel(table_name = messages)]
pub struct MessageDB {
  pub id: String,
  pub guild_id: i64,
  pub channel_id: i64,
  pub user_id: i64,
  pub created: i64,
  pub model: String,
  pub request: String,
  pub response: String,
  pub request_tags: Vec<String>,
  pub response_tags: Vec<String>,
}

#[derive(Insertable)]
#[diesel(table_name = messages)]
pub struct NewMessageDB<'a> {
  pub id: &'a str,
  pub guild_id: i64,
  pub channel_id: i64,
  pub user_id: i64,
  pub created: i64,
  pub model: &'a str,
  pub request: &'a str,
  pub response: &'a str,
  pub request_tags: Vec<&'a str>,
  pub response_tags: Vec<&'a str>,
}