# shellcheck shell=dash disable=SC2034,SC2154
# https://gitea.com/api/swagger#/issue/issueEditIssue
___x_cmd_fjo_issue_edit() {
    param:scope ___x_cmd_fjo
    param:dsl '
options:
    #1                  "The number that identifies the issue."                                  <>:number
    --repo|-r           "<owner_path>/<repo_path>"                                               <>:RepoName
    --title             "The title of the issue."                                                <>=""
    --ref               "ref"                                                                    <>=""
    --body              "The contents of the issue."                                             <>=""
    --state             "whether issue is open or closed Available values : closed, open"        <>=""
    --assignees         "User responsible for this issue.(separated by commas)"                  <>:array=""
    --milestone         "milestone number"                                                       <>:number=""
    --due_date          "due date"                                                               <>:date=""
    --unset_due_date    "unset due date"
    --json|-j           "output json data"
'
    param:run
    local tmp_assignees
    tmp_assignees="$(x jo "[$assignees]")"
    local gen_fjo_json
    gen_fjo_json="$(param:option2json -repo -assignees ${assignees+"assignees=tmp_assignees"} 'unset_due_date=^^unset_due_date')"

    ___x_cmd_fjo_param_init_owner_repo
    ___x_cmd_fjo_curl patch "/repos/${owner_repo}/issues/${1}" "gen_fjo_json" | ___x_cmd_fjo_issue____ui_handler Edit
}


