use actix_web::web::ServiceConfig;
use chrono::NaiveDate;
use serde::Deserialize;

mod area;
mod assignment;
mod availability;
mod events;
mod export;
mod location;
pub mod user;
mod imprint;
mod vehicle;

#[derive(Deserialize)]
pub struct IdPath {
    pub id: i32,
}

#[derive(Deserialize)]
pub struct NaiveDateQuery {
    pub date: NaiveDate,
}

pub fn init(cfg: &mut ServiceConfig) {
    cfg.service(location::get_overview::get);
    cfg.service(location::get_new::get);
    cfg.service(location::post_new::post);
    cfg.service(location::get_edit::get);
    cfg.service(location::post_edit::post);
    cfg.service(location::delete::delete);

    cfg.service(user::get_overview::get_overview);
    cfg.service(user::get_new::get_new);
    cfg.service(user::post_new::post_new);
    cfg.service(user::get_edit::get_edit);
    cfg.service(user::post_edit::post_edit);
    cfg.service(user::delete::delete);
    cfg.service(user::get_logout::get);
    cfg.service(user::get_login::get);
    cfg.service(user::post_login::post);
    cfg.service(user::get_reset::get);
    cfg.service(user::post_reset::post);
    cfg.service(user::get_profile::get);
    cfg.service(user::post_toggle::post);
    cfg.service(user::get_changepassword::get);
    cfg.service(user::post_changepassword::post);
    cfg.service(user::get_register::get);
    cfg.service(user::post_register::post);

    cfg.service(availability::delete::delete);
    cfg.service(availability::get_new::get);
    cfg.service(availability::get_overview::get);
    cfg.service(availability::get_update::get);
    cfg.service(availability::post_new::post);
    cfg.service(availability::post_update::post);

    cfg.service(events::get_new::get);
    cfg.service(events::post_new::post);
    cfg.service(events::get_plan::get);

    cfg.service(assignment::post_new::post);
    cfg.service(assignment::delete::delete);

    cfg.service(area::get_new::get);
    cfg.service(area::post_new::post);
    cfg.service(area::get_edit::get);
    cfg.service(area::post_edit::post);
    cfg.service(area::delete::delete);

    cfg.service(export::get_availability::get);
    cfg.service(export::get_availability_data::get);

    cfg.service(imprint::get_imprint);

    cfg.service(vehicle::delete::delete);
    cfg.service(vehicle::get_new::get);
    cfg.service(vehicle::get_edit::get);
    cfg.service(vehicle::get_overview::get);
    cfg.service(vehicle::post_new::post);
    cfg.service(vehicle::post_edit::post);
}
