---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Whimsical.
--- DateTime: 2021-08-24 5:48 p.m.
---

command_name = "zone"

runOn = {
    instructions = true,
    handlers = false
}

---@param parameters ArkhamImport_Command_DescriptionInstructionArguments
---@return ArkhamImport_Command_DescriptionInstructionResults
function do_instruction(parameters)
    local args = parameters.arguments
    if (#args<4 or #args>6) then
        return {
            is_successful = false,
            error_message = "Zone Command requires between 4 and 6 arguments. " .. #args .. " were provided."
        }
    end

    local name = args[1]
    local position = Vector(tonumber(args[2]), tonumber(args[3]), tonumber(args[4]))
    local is_facedown= (args[5] and args[5]:lower()=="true") or false
    local is_absolute = (args[6] and args[6]:lower() == "true") or false

    ---@type ArkhamImportZone
    local zone = {
        position = position,
        is_facedown = is_facedown,
        is_absolute = is_absolute
    }

    parameters.configuration.zones[name] = zone

    return {
        configuration = parameters.configuration,
        is_successful = true
    }
end