# shellcheck shell=bash disable=SC2034,SC2154 disable=SC2154
# Section:list & info
# https://gitea.com/api/swagger#/repository/repoListBranches
___x_cmd_fjo_repo_branch_ll(){
    param:scope     ___x_cmd_fjo
    param:dsl       '
options:
    --repo|-r       "<owner_path>/<repo_path>"                                          <>:RepoName
    --limit         "Results per page"                                                  <>:Numbers="30"
    --page          "Page number of the results to fetch."                              <>:Numbers="1"

    --json|-j       "output origin json data"
    --csv           "output csv data"
    --yml           "output yml data"
'
    param:run

    ___x_cmd_fjo_param_init_owner_repo

    if ___x_cmd_gx_output_is_format; then
        ___x_cmd_fjo_get_multi "/repos/${owner_repo}/branches" | ___x_cmd_gx_output_format
    else
        ___x_cmd_fjo_get_multi "/repos/${owner_repo}/branches" |\
            ___x_cmd jo 2c .name .protected .commit.id |\
            ___x_cmd csv header --add  Name    Protected   LastCommit  | \
            if [ -n "$csv" ]; then  ___x_cmd_cmds cat
            else                    ___x_cmd csv static_tab
            fi
    fi
}
