fn main() -> Result<(), Box<dyn std::error::Error>> {
    let proto_file = "proto/admin.proto";
    let out_dir = "admin/generated";
    std::fs::create_dir_all(out_dir)?;

    tonic_prost_build::configure()
        .out_dir(out_dir)
        .compile_protos(&[proto_file], &["proto/"])?;

    let service = tonic_prost_build::manual::Service::builder()
        .name("SessionAdmin")
        .package("admin")
        .method(
            tonic_prost_build::manual::Method::builder()
                .name("list_workspace_sessions")
                .route_name("ListWorkspaceSessions")
                .input_type("crate::admin::generated::admin::ListWorkspaceSessionsRequest")
                .output_type("crate::admin::generated::admin::ListWorkspaceSessionsResponse")
                .codec_path("tonic_prost::ProstCodec")
                .build(),
        )
        .method(
            tonic_prost_build::manual::Method::builder()
                .name("list_user_sessions")
                .route_name("ListUserSessions")
                .input_type("crate::admin::generated::admin::ListUserSessionsRequest")
                .output_type("crate::admin::generated::admin::ListUserSessionsResponse")
                .codec_path("tonic_prost::ProstCodec")
                .build(),
        )
        .method(
            tonic_prost_build::manual::Method::builder()
                .name("kick_user_from_workspace")
                .route_name("KickUserFromWorkspace")
                .input_type("crate::admin::generated::admin::KickUserFromWorkspaceRequest")
                .output_type("crate::admin::generated::admin::KickUserFromWorkspaceResponse")
                .codec_path("tonic_prost::ProstCodec")
                .build(),
        )
        .method(
            tonic_prost_build::manual::Method::builder()
                .name("kick_user")
                .route_name("KickUser")
                .input_type("crate::admin::generated::admin::KickUserRequest")
                .output_type("crate::admin::generated::admin::KickUserResponse")
                .codec_path("tonic_prost::ProstCodec")
                .build(),
        )
        .method(
            tonic_prost_build::manual::Method::builder()
                .name("get_user_status")
                .route_name("GetUserStatus")
                .input_type("crate::admin::generated::admin::GetUserStatusRequest")
                .output_type("crate::admin::generated::admin::GetUserStatusResponse")
                .codec_path("tonic_prost::ProstCodec")
                .build(),
        )
        .method(
            tonic_prost_build::manual::Method::builder()
                .name("get_user_info")
                .route_name("GetUserInfo")
                .input_type("crate::admin::generated::admin::GetUserInfoRequest")
                .output_type("crate::admin::generated::admin::GetUserInfoResponse")
                .codec_path("tonic_prost::ProstCodec")
                .build(),
        )
        .method(
            tonic_prost_build::manual::Method::builder()
                .name("get_workspace_online_users")
                .route_name("GetWorkspaceOnlineUsers")
                .input_type("crate::admin::generated::admin::GetWorkspaceOnlineUsersRequest")
                .output_type("crate::admin::generated::admin::GetWorkspaceOnlineUsersResponse")
                .codec_path("tonic_prost::ProstCodec")
                .build(),
        )
        .method(
            tonic_prost_build::manual::Method::builder()
                .name("is_user_online")
                .route_name("IsUserOnline")
                .input_type("crate::admin::generated::admin::IsUserOnlineRequest")
                .output_type("crate::admin::generated::admin::IsUserOnlineResponse")
                .codec_path("tonic_prost::ProstCodec")
                .build(),
        )
        .method(
            tonic_prost_build::manual::Method::builder()
                .name("get_metrics")
                .route_name("GetMetrics")
                .input_type("crate::admin::generated::admin::GetMetricsRequest")
                .output_type("crate::admin::generated::admin::GetMetricsResponse")
                .codec_path("tonic_prost::ProstCodec")
                .build(),
        )
        .method(
            tonic_prost_build::manual::Method::builder()
                .name("export_metrics_csv")
                .route_name("ExportMetricsCsv")
                .input_type("crate::admin::generated::admin::ExportMetricsCsvRequest")
                .output_type("crate::admin::generated::admin::ExportMetricsCsvResponse")
                .codec_path("tonic_prost::ProstCodec")
                .build(),
        )
        .build();

    tonic_prost_build::manual::Builder::new()
        .out_dir(out_dir)
        .build_transport(true)
        .compile(&[service]);

    Ok(())
}
