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

---@class IamIpmiCmds.GetSessionTimeoutReq
---@field ManufactureId integer
---@field SessionType integer
local TGetSessionTimeoutReq = {}
TGetSessionTimeoutReq.__index = TGetSessionTimeoutReq
TGetSessionTimeoutReq.group = {}

local function TGetSessionTimeoutReq_from_obj(obj)
    return setmetatable(obj, TGetSessionTimeoutReq)
end

function TGetSessionTimeoutReq.new(ManufactureId, SessionType)
    return TGetSessionTimeoutReq_from_obj({ManufactureId = ManufactureId, SessionType = SessionType})
end
---@param obj IamIpmiCmds.GetSessionTimeoutReq
function TGetSessionTimeoutReq:init_from_obj(obj)
    self.ManufactureId = obj.ManufactureId
    self.SessionType = obj.SessionType
end

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

TGetSessionTimeoutReq.from_obj = TGetSessionTimeoutReq_from_obj

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

TGetSessionTimeoutReq.default = {0, 0}

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

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

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

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

GetSessionTimeout.GetSessionTimeoutReq = TGetSessionTimeoutReq

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

local function TGetSessionTimeoutRsp_from_obj(obj)
    return setmetatable(obj, TGetSessionTimeoutRsp)
end

function TGetSessionTimeoutRsp.new(CompletionCode, ManufactureId, Length, Data)
    return TGetSessionTimeoutRsp_from_obj({
        CompletionCode = CompletionCode,
        ManufactureId = ManufactureId,
        Length = Length,
        Data = Data
    })
end
---@param obj IamIpmiCmds.GetSessionTimeoutRsp
function TGetSessionTimeoutRsp:init_from_obj(obj)
    self.CompletionCode = obj.CompletionCode
    self.ManufactureId = obj.ManufactureId
    self.Length = obj.Length
    self.Data = obj.Data
end

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

TGetSessionTimeoutRsp.from_obj = TGetSessionTimeoutRsp_from_obj

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

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

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

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

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

GetSessionTimeout.GetSessionTimeoutRsp = TGetSessionTimeoutRsp

return GetSessionTimeout
