--[[-- Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
-- 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 GetTwoFactorAuthState = {}

---@class iamIpmiCmds.GetTwoFactorAuthStateReq
---@field ManufactureId integer
local TGetTwoFactorAuthStateReq = {}
TGetTwoFactorAuthStateReq.__index = TGetTwoFactorAuthStateReq
TGetTwoFactorAuthStateReq.group = {}

local function TGetTwoFactorAuthStateReq_from_obj(obj)
    return setmetatable(obj, TGetTwoFactorAuthStateReq)
end

function TGetTwoFactorAuthStateReq.new(ManufactureId)
    return TGetTwoFactorAuthStateReq_from_obj({ManufactureId = ManufactureId})
end
---@param obj iamIpmiCmds.GetTwoFactorAuthStateReq
function TGetTwoFactorAuthStateReq:init_from_obj(obj)
    self.ManufactureId = obj.ManufactureId
end

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

TGetTwoFactorAuthStateReq.from_obj = TGetTwoFactorAuthStateReq_from_obj

TGetTwoFactorAuthStateReq.proto_property = {'ManufactureId'}

TGetTwoFactorAuthStateReq.default = {0}

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

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

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

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

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

GetTwoFactorAuthState.GetTwoFactorAuthStateReq = TGetTwoFactorAuthStateReq

---@class iamIpmiCmds.GetTwoFactorAuthStateRsp
---@field CompletionCode integer
---@field ManufactureId integer
---@field Enabled integer
---@field OCSPEnabled integer
local TGetTwoFactorAuthStateRsp = {}
TGetTwoFactorAuthStateRsp.__index = TGetTwoFactorAuthStateRsp
TGetTwoFactorAuthStateRsp.group = {}

local function TGetTwoFactorAuthStateRsp_from_obj(obj)
    return setmetatable(obj, TGetTwoFactorAuthStateRsp)
end

function TGetTwoFactorAuthStateRsp.new(CompletionCode, ManufactureId, Enabled, OCSPEnabled)
    return TGetTwoFactorAuthStateRsp_from_obj({
        CompletionCode = CompletionCode,
        ManufactureId = ManufactureId,
        Enabled = Enabled,
        OCSPEnabled = OCSPEnabled
    })
end
---@param obj iamIpmiCmds.GetTwoFactorAuthStateRsp
function TGetTwoFactorAuthStateRsp:init_from_obj(obj)
    self.CompletionCode = obj.CompletionCode
    self.ManufactureId = obj.ManufactureId
    self.Enabled = obj.Enabled
    self.OCSPEnabled = obj.OCSPEnabled
end

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

TGetTwoFactorAuthStateRsp.from_obj = TGetTwoFactorAuthStateRsp_from_obj

TGetTwoFactorAuthStateRsp.proto_property = {'CompletionCode', 'ManufactureId', 'Enabled', 'OCSPEnabled'}

TGetTwoFactorAuthStateRsp.default = {0, 0, 0, 0}

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

function TGetTwoFactorAuthStateRsp: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 .. 'Enabled', self.Enabled, 'uint8', false, errs, need_convert)
    validate.Optional(prefix .. 'OCSPEnabled', self.OCSPEnabled, 'uint8', false, errs, need_convert)

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

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

GetTwoFactorAuthState.GetTwoFactorAuthStateRsp = TGetTwoFactorAuthStateRsp

return GetTwoFactorAuthState
