pub mod avatar;
pub mod chpc;
pub mod public;
pub mod relation;
pub mod summary;

use actix_web::{web, web::ServiceConfig};

pub fn configure(cfg: &mut ServiceConfig) {
    cfg.service(
        web::scope("/users")
            .service(
                web::resource("/avatar/{username}")
                    .route(web::get().to(avatar::user_avatar)),
            )
            .service(
                web::resource("/{username}/summary")
                    .route(web::get().to(summary::user_summary)),
            )
            .service(
                web::resource("/{username}/public")
                    .route(web::get().to(public::user_public)),
            )
            .service(
                web::resource("/{username}/contribution-heatmap")
                    .route(web::get().to(chpc::user_chpc)),
            )
            .service(
                web::resource("/{username}/follow")
                    .route(web::post().to(relation::follow_user)),
            )
            .service(
                web::resource("/{username}/unfollow")
                    .route(web::post().to(relation::unfollow_user)),
            )
            .service(
                web::resource("/{username}/block")
                    .route(web::post().to(relation::block_user)),
            )
            .service(
                web::resource("/{username}/unblock")
                    .route(web::post().to(relation::unblock_user)),
            )
            .service(
                web::resource("/{username}/relation")
                    .route(web::get().to(relation::relation_status)),
            )
            .service(
                web::resource("/{username}/followers")
                    .route(web::get().to(relation::followers)),
            )
            .service(
                web::resource("/{username}/following")
                    .route(web::get().to(relation::following)),
            )
            .service(
                web::resource("/blocked")
                    .route(web::get().to(relation::blocked_list)),
            )
            .service(
                web::resource("/{username}/relation-counts")
                    .route(web::get().to(relation::relation_counts)),
            ),
    );
}
