pub mod assignee;
pub mod binding;
pub mod comment;
pub mod event;
pub mod issue;
pub mod label;
pub mod milestone;
pub mod reaction;

use actix_web::{web, web::ServiceConfig};
pub fn configure(cfg: &mut ServiceConfig) {
    cfg.service(
        web::resource("")
            .route(web::post().to(issue::create_issue))
            .route(web::get().to(issue::list_issues)),
    );
    cfg.service(
        web::resource("/{number}")
            .route(web::get().to(issue::get_issue))
            .route(web::put().to(issue::update_issue))
            .route(web::delete().to(issue::delete_issue)),
    );
    cfg.service(
        web::resource("/{number}/close")
            .route(web::post().to(issue::close_issue)),
    );
    cfg.service(
        web::resource("/{number}/reopen")
            .route(web::post().to(issue::reopen_issue)),
    );
    cfg.service(
        web::resource("/{number}/comments")
            .route(web::get().to(comment::list_comments))
            .route(web::post().to(comment::create_comment)),
    );
    cfg.service(
        web::resource("/{number}/comments/{comment_id}")
            .route(web::put().to(comment::update_comment))
            .route(web::delete().to(comment::delete_comment)),
    );
    cfg.service(
        web::resource("/{number}/assignees")
            .route(web::post().to(assignee::assign_user))
            .route(web::delete().to(assignee::unassign_user)),
    );
    cfg.service(
        web::resource("/{number}/labels")
            .route(web::post().to(label::add_issue_label))
            .route(web::delete().to(label::remove_issue_label)),
    );
    cfg.service(
        web::resource("/{number}/milestone")
            .route(web::post().to(milestone::set_issue_milestone))
            .route(web::delete().to(milestone::clear_issue_milestone)),
    );
    cfg.service(
        web::resource("/{number}/repos")
            .route(web::post().to(binding::bind_repo))
            .route(web::delete().to(binding::unbind_repo)),
    );
    cfg.service(
        web::resource("/{number}/pull-requests")
            .route(web::post().to(binding::bind_pull_request))
            .route(web::delete().to(binding::unbind_pull_request)),
    );
    cfg.service(
        web::resource("/{number}/reactions")
            .route(web::post().to(reaction::add_reaction))
            .route(web::delete().to(reaction::remove_reaction)),
    );
    cfg.service(
        web::resource("/{number}/comments/{comment_id}/reactions")
            .route(web::post().to(reaction::add_comment_reaction))
            .route(web::delete().to(reaction::remove_comment_reaction)),
    );
    cfg.service(
        web::resource("/{number}/events")
            .route(web::get().to(event::list_events)),
    );
}
pub fn configure_labels(cfg: &mut ServiceConfig) {
    cfg.service(
        web::resource("")
            .route(web::get().to(label::list_labels))
            .route(web::post().to(label::create_label)),
    );
    cfg.service(
        web::resource("/{label_id}")
            .route(web::put().to(label::update_label))
            .route(web::delete().to(label::delete_label)),
    );
}
pub fn configure_milestones(cfg: &mut ServiceConfig) {
    cfg.service(
        web::resource("")
            .route(web::get().to(milestone::list_milestones))
            .route(web::post().to(milestone::create_milestone)),
    );
    cfg.service(
        web::resource("/{milestone_id}")
            .route(web::put().to(milestone::update_milestone))
            .route(web::delete().to(milestone::delete_milestone)),
    );
}
