--[[-- 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-3-15
-- Description: DO NOT EDIT; Code generated by "ipmi_message.lua.mako"
]] --
local validate = require 'mc.validate'
local utils = require 'mc.utils'

local GetHistoryPwdCheckCount = {}

---@class AccountIpmiCmds.GetHistoryPwdCheckCountReq
---@field ManufactureId integer
---@field UserId integer
---@field Reserved1 integer
local TGetHistoryPwdCheckCountReq = {}
TGetHistoryPwdCheckCountReq.__index = TGetHistoryPwdCheckCountReq
TGetHistoryPwdCheckCountReq.group = {}

local function TGetHistoryPwdCheckCountReq_from_obj(obj)
    return setmetatable(obj, TGetHistoryPwdCheckCountReq)
end

function TGetHistoryPwdCheckCountReq.new(ManufactureId, UserId, Reserved1)
    return TGetHistoryPwdCheckCountReq_from_obj({
        ManufactureId = ManufactureId,
        UserId = UserId,
        Reserved1 = Reserved1
    })
end
---@param obj AccountIpmiCmds.GetHistoryPwdCheckCountReq
function TGetHistoryPwdCheckCountReq:init_from_obj(obj)
    self.ManufactureId = obj.ManufactureId
    self.UserId = obj.UserId
    self.Reserved1 = obj.Reserved1
end

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

TGetHistoryPwdCheckCountReq.from_obj = TGetHistoryPwdCheckCountReq_from_obj

TGetHistoryPwdCheckCountReq.proto_property = {
    'ManufactureId', 'UserId', 'Reserved1'
}

TGetHistoryPwdCheckCountReq.default = {0, 0, 0}

TGetHistoryPwdCheckCountReq.struct = {
    {name = 'ManufactureId', is_array = false, struct = nil},
    {name = 'UserId', is_array = false, struct = nil},
    {name = 'Reserved1', is_array = false, struct = nil}
}

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

    validate.Optional(prefix .. 'ManufactureId', self.ManufactureId, "uint32",
                      false, errs, need_convert)
    validate.Optional(prefix .. 'UserId', self.UserId, "uint8", false, errs,
                      need_convert)
    validate.Optional(prefix .. 'Reserved1', self.Reserved1, "uint8", false,
                      errs, need_convert)

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

function TGetHistoryPwdCheckCountReq:unpack(_)
    return self.ManufactureId, self.UserId, self.Reserved1
end

GetHistoryPwdCheckCount.GetHistoryPwdCheckCountReq = TGetHistoryPwdCheckCountReq

---@class AccountIpmiCmds.GetHistoryPwdCheckCountRsp
---@field CompletionCode integer
---@field ManufactureId integer
---@field Length integer
---@field Data string
local TGetHistoryPwdCheckCountRsp = {}
TGetHistoryPwdCheckCountRsp.__index = TGetHistoryPwdCheckCountRsp
TGetHistoryPwdCheckCountRsp.group = {}

local function TGetHistoryPwdCheckCountRsp_from_obj(obj)
    return setmetatable(obj, TGetHistoryPwdCheckCountRsp)
end

function TGetHistoryPwdCheckCountRsp.new(CompletionCode, ManufactureId, Length,
                                         Data)
    return TGetHistoryPwdCheckCountRsp_from_obj({
        CompletionCode = CompletionCode,
        ManufactureId = ManufactureId,
        Length = Length,
        Data = Data
    })
end
---@param obj AccountIpmiCmds.GetHistoryPwdCheckCountRsp
function TGetHistoryPwdCheckCountRsp:init_from_obj(obj)
    self.CompletionCode = obj.CompletionCode
    self.ManufactureId = obj.ManufactureId
    self.Length = obj.Length
    self.Data = obj.Data
end

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

TGetHistoryPwdCheckCountRsp.from_obj = TGetHistoryPwdCheckCountRsp_from_obj

TGetHistoryPwdCheckCountRsp.proto_property = {
    'CompletionCode', 'ManufactureId', 'Length', 'Data'
}

TGetHistoryPwdCheckCountRsp.default = {0, 0, 0, ''}

TGetHistoryPwdCheckCountRsp.struct = {
    {name = 'CompletionCode', is_array = false, struct = nil},
    {name = 'ManufactureId', is_array = false, struct = nil},
    {name = 'Length', is_array = false, struct = nil},
    {name = 'Data', is_array = false, struct = nil}
}

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

    validate.Optional(prefix .. 'CompletionCode', self.CompletionCode, "uint8",
                      false, errs, need_convert)
    validate.Optional(prefix .. 'ManufactureId', self.ManufactureId, "uint32",
                      false, errs, need_convert)
    validate.Optional(prefix .. 'Length', self.Length, "uint8", false, errs,
                      need_convert)
    validate.Optional(prefix .. 'Data', self.Data, "string", false, errs,
                      need_convert)

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

function TGetHistoryPwdCheckCountRsp:unpack(_)
    return self.CompletionCode, self.ManufactureId, self.Length, self.Data
end

GetHistoryPwdCheckCount.GetHistoryPwdCheckCountRsp = TGetHistoryPwdCheckCountRsp

return GetHistoryPwdCheckCount
