# shellcheck shell=dash disable=SC2034,SC2154
# https://gitea.com/api/swagger#/organization/orgEditTeam
___x_cmd_fjo_team_edit() {
    param:scope     ___x_cmd_fjo
    param:dsl       <<A
options:
    #1                             "team id"                                <>
    --name                         "team name"                              <>
    --units                        "Allow access to repo unit"              <>:Array=""
    --units_map                    "repo units permission"                  <>=""
    --description                  "A short description of the team"        <>:Org_Description=""
    --permission                   "team permission"                        <>=""    = read write admin
    --can_create_org_repo          "can create org repo"
    --includes_all_repositories    "includes all repositories"
    --json|-j                      "output json data"
A
    param:run
    units="$(x jo "[$units]")"
    local gen_fjo_json
    gen_fjo_json="$(param:option2json 'can_create_org_repo=^^can_create_org_repo'\
    'includes_all_repositories=^^includes_all_repositories')"

    ___x_cmd_fjo_curl patch "/teams/${1}" "gen_fjo_json" | ___x_cmd_fjo_team____ui_handler Update
}
