# shellcheck shell=bash disable=SC2034,SC2154
# https://gitea.com/api/swagger#/repository/repoDeleteTeam
___x_cmd_fjo_repo_team_rm() {
    param:scope     ___x_cmd_fjo
    param:dsl       <<A
options:
    --repo|-r       "<owner_path>/<repo_path>"              <>:RepoName=""
    --team          "team name"                             <>

    --yes|-y        "Ignore remove prompt interception"
A

    param:run
    ___x_cmd_fjo_param_init_owner_repo

    [ "$yes" = "true" ] || ___x_cmd_ui_yesno "Are you sure remove [team=$(___x_cmd_ui bold red "$team")] from [repo=$(___x_cmd_ui bold red "$repo")] ?" || return
    ___x_cmd_fjo_curl del "/repos/${owner_repo}/teams/${team}" | (
        ___x_cmd jo env . fjo_resp_err=.message
        if ___x_cmd_fjo_http_error; then
            ___x_cmd_ui_tf  true "delete [team=$team]  success"
        else
            ___x_cmd_ui_tf false "delete team failure: $team."
            ___x_cmd_fjo____handle_resp
            return 1
        fi
    )
}
