# shellcheck shell=dash disable=SC2034,SC2154
# https://gitea.com/api/swagger#/repository/repoDeleteHook
___x_cmd_fjo_repo_hook_rm() {
    param:scope     ___x_cmd_fjo
    param:dsl       <<A
options:
    #1          "The unique identifier of the hook."                                    <>:Number
    --repo|-r   "<owner_path>/<repo_path>"                                              <>:RepoName
    --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 you want to remove the hook $(___x_cmd_ui bold red "$1") in the $owner_repo ?" || return
    ___x_cmd_fjo_curl del "/repos/${owner_repo}/hooks/$1" | (
        x jo env . fjo_resp_err=.message
        if ___x_cmd_fjo_http_error; then
            ___x_cmd_ui_tf  true "successfully remove repo hook"
        else
            ___x_cmd_ui_tf false "delete repo hook failure: $1"
            ___x_cmd_fjo____handle_resp
            return 1
        fi
    )
}

