use serde::Serialize;

pub mod member;
pub mod common;
pub mod invites;
pub mod channels;
pub mod messages;
pub mod auth;

use std::vec::Vec;

pub type BigInt = i64;
pub type UBigInt = u64;

pub type Integer = i32;
pub type UInteger = u32;

pub type VarChar = String;

#[derive(Debug)]
pub enum Response<T> {
    // A set of rows collected
    Set(Vec<T>),
    // Single row collected
    Row(T),
    // Nothing was found -> for select/update/delete's
    Empty,
    // Generic success for things like update/delete's
    Success,
    // Mask 500's with probable user generated errors like duplicate keys being added
    // or data that doesn't fit in column or something
    RestrictedInput(String),
    // Not sure what this will be used for but maybe its useful at some point
    Other(String)
}

#[allow(dead_code)]
#[derive(Serialize)]
pub struct Message {
    pub id: UBigInt,
    pub time: BigInt,
    pub content: VarChar,
    pub content_type: VarChar,
    pub author_id: UBigInt,
    pub channel_id: UBigInt
}

#[derive(Debug, Serialize)]
pub struct UserMessage {
    pub id: UBigInt,
    pub time: BigInt,
    pub content: VarChar,
    pub content_type: VarChar,
    pub author_id: UBigInt,
    pub channel_id: UBigInt,
    pub name: VarChar
}



#[derive(Serialize)]
pub struct Channel {
    pub id: UBigInt,
    pub name: VarChar,
    pub description: Option<VarChar>,
    pub kind: Integer
}

#[derive(Serialize, Debug)]
pub struct Invite {
    pub id: BigInt,
    pub uses: Option<BigInt>,
    pub expires: bool
}

#[derive(Debug, Serialize)]
pub struct Member {
    pub id: UBigInt,
    pub secret: VarChar,
    pub name: VarChar,
    pub status: Integer,
    pub permissions: UBigInt,
}

