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

---@class IamIpmiCmds.GetSessionModeReq
---@field ManufactureId integer
---@field SessionType integer
local TGetSessionModeReq = {}
TGetSessionModeReq.__index = TGetSessionModeReq
TGetSessionModeReq.group = {}

local function TGetSessionModeReq_from_obj(obj)
    return setmetatable(obj, TGetSessionModeReq)
end

function TGetSessionModeReq.new(ManufactureId, SessionType)
    return TGetSessionModeReq_from_obj({ManufactureId = ManufactureId, SessionType = SessionType})
end
---@param obj IamIpmiCmds.GetSessionModeReq
function TGetSessionModeReq:init_from_obj(obj)
    self.ManufactureId = obj.ManufactureId
    self.SessionType = obj.SessionType
end

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

TGetSessionModeReq.from_obj = TGetSessionModeReq_from_obj

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

TGetSessionModeReq.default = {0, 0}

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

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

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

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

GetSessionMode.GetSessionModeReq = TGetSessionModeReq

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

local function TGetSessionModeRsp_from_obj(obj)
    return setmetatable(obj, TGetSessionModeRsp)
end

function TGetSessionModeRsp.new(CompletionCode, ManufactureId, Length, Data)
    return TGetSessionModeRsp_from_obj({
        CompletionCode = CompletionCode,
        ManufactureId = ManufactureId,
        Length = Length,
        Data = Data
    })
end
---@param obj IamIpmiCmds.GetSessionModeRsp
function TGetSessionModeRsp:init_from_obj(obj)
    self.CompletionCode = obj.CompletionCode
    self.ManufactureId = obj.ManufactureId
    self.Length = obj.Length
    self.Data = obj.Data
end

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

TGetSessionModeRsp.from_obj = TGetSessionModeRsp_from_obj

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

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

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

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

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

GetSessionMode.GetSessionModeRsp = TGetSessionModeRsp

return GetSessionMode
