--[[-- 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 GetSessionMaxCount = {}

---@class IamIpmiCmds.GetSessionMaxCountReq
---@field ManufactureId integer
---@field SessionType integer
local TGetSessionMaxCountReq = {}
TGetSessionMaxCountReq.__index = TGetSessionMaxCountReq
TGetSessionMaxCountReq.group = {}

local function TGetSessionMaxCountReq_from_obj(obj)
    return setmetatable(obj, TGetSessionMaxCountReq)
end

function TGetSessionMaxCountReq.new(ManufactureId, SessionType)
    return TGetSessionMaxCountReq_from_obj({ManufactureId = ManufactureId, SessionType = SessionType})
end
---@param obj IamIpmiCmds.GetSessionMaxCountReq
function TGetSessionMaxCountReq:init_from_obj(obj)
    self.ManufactureId = obj.ManufactureId
    self.SessionType = obj.SessionType
end

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

TGetSessionMaxCountReq.from_obj = TGetSessionMaxCountReq_from_obj

TGetSessionMaxCountReq.proto_property = {'ManufactureId', 'SessionType'}

TGetSessionMaxCountReq.default = {0, 0}

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

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

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

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

function TGetSessionMaxCountReq:unpack(_)
    return self.ManufactureId, self.SessionType
end

GetSessionMaxCount.GetSessionMaxCountReq = TGetSessionMaxCountReq

---@class IamIpmiCmds.GetSessionMaxCountRsp
---@field CompletionCode integer
---@field ManufactureId integer
---@field Length integer
---@field Data string
local TGetSessionMaxCountRsp = {}
TGetSessionMaxCountRsp.__index = TGetSessionMaxCountRsp
TGetSessionMaxCountRsp.group = {}

local function TGetSessionMaxCountRsp_from_obj(obj)
    return setmetatable(obj, TGetSessionMaxCountRsp)
end

function TGetSessionMaxCountRsp.new(CompletionCode, ManufactureId, Length, Data)
    return TGetSessionMaxCountRsp_from_obj({
        CompletionCode = CompletionCode,
        ManufactureId = ManufactureId,
        Length = Length,
        Data = Data
    })
end
---@param obj IamIpmiCmds.GetSessionMaxCountRsp
function TGetSessionMaxCountRsp:init_from_obj(obj)
    self.CompletionCode = obj.CompletionCode
    self.ManufactureId = obj.ManufactureId
    self.Length = obj.Length
    self.Data = obj.Data
end

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

TGetSessionMaxCountRsp.from_obj = TGetSessionMaxCountRsp_from_obj

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

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

TGetSessionMaxCountRsp.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 TGetSessionMaxCountRsp: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)

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

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

GetSessionMaxCount.GetSessionMaxCountRsp = TGetSessionMaxCountRsp

return GetSessionMaxCount
