--[[-- Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
--
-- this file licensed under the 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.
--
-- Author: auto generate
-- Create: 2025-8-21
-- Description: DO NOT EDIT; Code generated by "ipmi_message.lua.mako"
]] --
local validate = require 'mc.validate'
local utils = require 'mc.utils'

local SetTwoFactorAuthState = {}

---@class IamIpmiCmds.SetTwoFactorAuthStateReq
---@field ManufactureId integer
---@field Enabled integer
---@field OCSPEnabled integer
local TSetTwoFactorAuthStateReq = {}
TSetTwoFactorAuthStateReq.__index = TSetTwoFactorAuthStateReq
TSetTwoFactorAuthStateReq.group = {}

local function TSetTwoFactorAuthStateReq_from_obj(obj)
    return setmetatable(obj, TSetTwoFactorAuthStateReq)
end

function TSetTwoFactorAuthStateReq.new(ManufactureId, Enabled, OCSPEnabled)
    return TSetTwoFactorAuthStateReq_from_obj({
        ManufactureId = ManufactureId,
        Enabled = Enabled,
        OCSPEnabled = OCSPEnabled
    })
end
---@param obj IamIpmiCmds.SetTwoFactorAuthStateReq
function TSetTwoFactorAuthStateReq:init_from_obj(obj)
    self.ManufactureId = obj.ManufactureId
    self.Enabled = obj.Enabled
    self.OCSPEnabled = obj.OCSPEnabled
end

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

TSetTwoFactorAuthStateReq.from_obj = TSetTwoFactorAuthStateReq_from_obj

TSetTwoFactorAuthStateReq.proto_property = {'ManufactureId', 'Enabled', 'OCSPEnabled'}

TSetTwoFactorAuthStateReq.default = {0, 0, 0}

TSetTwoFactorAuthStateReq.struct = {
    {name = 'ManufactureId', is_array = false, struct = nil}, {name = 'Enabled', is_array = false, struct = nil},
    {name = 'OCSPEnabled', is_array = false, struct = nil}
}

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

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

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

function TSetTwoFactorAuthStateReq:unpack(_)
    return self.ManufactureId, self.Enabled, self.OCSPEnabled
end

SetTwoFactorAuthState.SetTwoFactorAuthStateReq = TSetTwoFactorAuthStateReq

---@class IamIpmiCmds.SetTwoFactorAuthStateRsp
---@field CompletionCode integer
---@field ManufactureId integer
local TSetTwoFactorAuthStateRsp = {}
TSetTwoFactorAuthStateRsp.__index = TSetTwoFactorAuthStateRsp
TSetTwoFactorAuthStateRsp.group = {}

local function TSetTwoFactorAuthStateRsp_from_obj(obj)
    return setmetatable(obj, TSetTwoFactorAuthStateRsp)
end

function TSetTwoFactorAuthStateRsp.new(CompletionCode, ManufactureId)
    return TSetTwoFactorAuthStateRsp_from_obj({CompletionCode = CompletionCode, ManufactureId = ManufactureId})
end
---@param obj IamIpmiCmds.SetTwoFactorAuthStateRsp
function TSetTwoFactorAuthStateRsp:init_from_obj(obj)
    self.CompletionCode = obj.CompletionCode
    self.ManufactureId = obj.ManufactureId
end

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

TSetTwoFactorAuthStateRsp.from_obj = TSetTwoFactorAuthStateRsp_from_obj

TSetTwoFactorAuthStateRsp.proto_property = {'CompletionCode', 'ManufactureId'}

TSetTwoFactorAuthStateRsp.default = {0, 0}

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

function TSetTwoFactorAuthStateRsp: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)

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

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

SetTwoFactorAuthState.SetTwoFactorAuthStateRsp = TSetTwoFactorAuthStateRsp

return SetTwoFactorAuthState
