# shellcheck shell=dash disable=SC2034,SC2154
# https://gitea.com/api/swagger#/organization/orgCreateTeam
___x_cmd_fjo_team_create() {
    param:scope     ___x_cmd_fjo
    param:dsl       <<A
options:
    #1                             "team name"                          <>
    --org                          "org space address"                  <>:Address
    --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
    local name="$1"
    units="$(x jo "[$units]")"
    local gen_fjo_json
    gen_fjo_json="$(param:option2json -org +name 'can_create_org_repo=^^can_create_org_repo'\
    'includes_all_repositories=^^includes_all_repositories')"
    fjo:debug "$gen_fjo_json"
    ___x_cmd_fjo_curl post  "/orgs/${org##*/}/teams" "gen_fjo_json" | ___x_cmd_fjo_team____ui_handler Creating
}
