--[[-- Copyright (c) 2024 Huawei Technologies Co., Ltd.
-- openUBMC is licensed under Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at:
--          http://license.coscl.org.cn/MulanPSL2
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
-- EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
-- MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
-- See the Mulan PSL v2 for more details.
]] --
local validate = require 'mc.validate'
local utils = require 'mc.utils'

local GetUserPassComplexity = {}

---@class AccountIpmiCmds.GetUserPassComplexityReq
---@field ManufactureId integer
local TGetUserPassComplexityReq = {}
TGetUserPassComplexityReq.__index = TGetUserPassComplexityReq
TGetUserPassComplexityReq.group = {}

local function TGetUserPassComplexityReq_from_obj(obj)
    return setmetatable(obj, TGetUserPassComplexityReq)
end

function TGetUserPassComplexityReq.new(ManufactureId)
    return TGetUserPassComplexityReq_from_obj({ManufactureId = ManufactureId})
end
---@param obj AccountIpmiCmds.GetUserPassComplexityReq
function TGetUserPassComplexityReq:init_from_obj(obj)
    self.ManufactureId = obj.ManufactureId
end

function TGetUserPassComplexityReq:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TGetUserPassComplexityReq.group)
end

TGetUserPassComplexityReq.from_obj = TGetUserPassComplexityReq_from_obj

TGetUserPassComplexityReq.proto_property = {'ManufactureId'}

TGetUserPassComplexityReq.default = {0}

TGetUserPassComplexityReq.struct = {{name = 'ManufactureId', is_array = false, struct = nil}}

function TGetUserPassComplexityReq:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'ManufactureId', self.ManufactureId, 'uint32', false, errs, need_convert)

    TGetUserPassComplexityReq:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TGetUserPassComplexityReq.proto_property, errs, need_convert)
    return self
end

function TGetUserPassComplexityReq:unpack(_)
    return self.ManufactureId
end

GetUserPassComplexity.GetUserPassComplexityReq = TGetUserPassComplexityReq

---@class AccountIpmiCmds.GetUserPassComplexityRsp
---@field CompletionCode integer
---@field ManufactureId integer
---@field Control integer
local TGetUserPassComplexityRsp = {}
TGetUserPassComplexityRsp.__index = TGetUserPassComplexityRsp
TGetUserPassComplexityRsp.group = {}

local function TGetUserPassComplexityRsp_from_obj(obj)
    return setmetatable(obj, TGetUserPassComplexityRsp)
end

function TGetUserPassComplexityRsp.new(CompletionCode, ManufactureId, Control)
    return TGetUserPassComplexityRsp_from_obj({
        CompletionCode = CompletionCode,
        ManufactureId = ManufactureId,
        Control = Control
    })
end
---@param obj AccountIpmiCmds.GetUserPassComplexityRsp
function TGetUserPassComplexityRsp:init_from_obj(obj)
    self.CompletionCode = obj.CompletionCode
    self.ManufactureId = obj.ManufactureId
    self.Control = obj.Control
end

function TGetUserPassComplexityRsp:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TGetUserPassComplexityRsp.group)
end

TGetUserPassComplexityRsp.from_obj = TGetUserPassComplexityRsp_from_obj

TGetUserPassComplexityRsp.proto_property = {'CompletionCode', 'ManufactureId', 'Control'}

TGetUserPassComplexityRsp.default = {0, 0, 0}

TGetUserPassComplexityRsp.struct = {
    {name = 'CompletionCode', is_array = false, struct = nil}, {name = 'ManufactureId', is_array = false, struct = nil},
    {name = 'Control', is_array = false, struct = nil}
}

function TGetUserPassComplexityRsp:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'CompletionCode', self.CompletionCode, 'uint32', false, errs, need_convert)
    validate.Optional(prefix .. 'ManufactureId', self.ManufactureId, 'uint32', false, errs, need_convert)
    validate.Optional(prefix .. 'Control', self.Control, 'uint8', false, errs, need_convert)

    TGetUserPassComplexityRsp:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TGetUserPassComplexityRsp.proto_property, errs, need_convert)
    return self
end

function TGetUserPassComplexityRsp:unpack(_)
    return self.CompletionCode, self.ManufactureId, self.Control
end

GetUserPassComplexity.GetUserPassComplexityRsp = TGetUserPassComplexityRsp

return GetUserPassComplexity
