use diesel::{
    dsl::{AsSelect, Select},
    pg::Pg,
    prelude::*,
};
use uuid::Uuid;

use crate::schema::teams::dsl::*;

#[derive(Clone, Debug, Identifiable, Insertable, Queryable, Selectable)]
#[diesel(table_name = crate::schema::teams)]
#[diesel(check_for_backend(Pg))]
pub struct Team {
    pub id: Uuid,
    pub name: String,
}

impl Team {
    pub fn all() -> Select<teams, AsSelect<Team, Pg>> {
        teams.select(Team::as_select())
    }
}
