# shellcheck shell=dash disable=SC2034,SC2154
# https://gitea.com/api/swagger#/issue/issueCreateIssue
___x_cmd_fjo_issue_create(){
    param:scope     ___x_cmd_fjo
    param:dsl       '
options:
    --repo|-r      "<owner_path>/<repo_path>"                                              <>:RepoName
    --title        "The title of the issue."                                               <>:string
    --ref          "ref"                                                                   <>=""
    --body         "The contents of the issue."                                            <>:string=""
    --labels       "list of label ids"                                                     <>:array=""
    --due_date     "due date"                                                              <>:date=""
    --assignees    "User responsible for this issue.(separated by commas)"                 <>:array=""
    --milestone    "milestone number"                                                      <>:number=""
    --closed       "Whether to close this issue"

    --json|-j      "output json data"
'
    param:run
    local tmp_assignees
    tmp_assignees="$(x jo "[$assignees]")"
    local tmp
    tmp="$(x jo "[$labels]")"
    local gen_fjo_json
    gen_fjo_json="$(param:option2json -repo -assignees -labels ${assignees+"assignees=tmp_assignees"} ${labels+"labels=tmp"} 'closed=^^closed')"

    ___x_cmd_fjo_param_init_owner_repo
    ___x_cmd_fjo_curl post "/repos/${owner_repo}/issues" "gen_fjo_json" | ___x_cmd_fjo_issue____ui_handler Creating
}


