--[[-- Copyright (c) 2026 Huawei Technologies Co., Ltd.
-- 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 SetFDMInfoMultiSystemPCIeAddrInfo = {}

---@class PcieDevice.SetFDMInfoMultiSystemPCIeAddrInfoReq
---@field ManufactureId integer
---@field Length integer
---@field Data string
local TSetFDMInfoMultiSystemPCIeAddrInfoReq = {}
TSetFDMInfoMultiSystemPCIeAddrInfoReq.__index = TSetFDMInfoMultiSystemPCIeAddrInfoReq
TSetFDMInfoMultiSystemPCIeAddrInfoReq.group = {}

local function TSetFDMInfoMultiSystemPCIeAddrInfoReq_from_obj(obj)
    return setmetatable(obj, TSetFDMInfoMultiSystemPCIeAddrInfoReq)
end

function TSetFDMInfoMultiSystemPCIeAddrInfoReq.new(ManufactureId, Length, Data)
    return TSetFDMInfoMultiSystemPCIeAddrInfoReq_from_obj({ManufactureId = ManufactureId, Length = Length, Data = Data})
end
---@param obj PcieDevice.SetFDMInfoMultiSystemPCIeAddrInfoReq
function TSetFDMInfoMultiSystemPCIeAddrInfoReq:init_from_obj(obj)
    self.ManufactureId = obj.ManufactureId
    self.Length = obj.Length
    self.Data = obj.Data
end

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

TSetFDMInfoMultiSystemPCIeAddrInfoReq.from_obj = TSetFDMInfoMultiSystemPCIeAddrInfoReq_from_obj

TSetFDMInfoMultiSystemPCIeAddrInfoReq.proto_property = {'ManufactureId', 'Length', 'Data'}

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

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

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

    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)

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

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

SetFDMInfoMultiSystemPCIeAddrInfo.SetFDMInfoMultiSystemPCIeAddrInfoReq = TSetFDMInfoMultiSystemPCIeAddrInfoReq

---@class PcieDevice.SetFDMInfoMultiSystemPCIeAddrInfoRsp
---@field CompletionCode integer
---@field ManufactureId integer
local TSetFDMInfoMultiSystemPCIeAddrInfoRsp = {}
TSetFDMInfoMultiSystemPCIeAddrInfoRsp.__index = TSetFDMInfoMultiSystemPCIeAddrInfoRsp
TSetFDMInfoMultiSystemPCIeAddrInfoRsp.group = {}

local function TSetFDMInfoMultiSystemPCIeAddrInfoRsp_from_obj(obj)
    return setmetatable(obj, TSetFDMInfoMultiSystemPCIeAddrInfoRsp)
end

function TSetFDMInfoMultiSystemPCIeAddrInfoRsp.new(CompletionCode, ManufactureId)
    return TSetFDMInfoMultiSystemPCIeAddrInfoRsp_from_obj({
        CompletionCode = CompletionCode,
        ManufactureId = ManufactureId
    })
end
---@param obj PcieDevice.SetFDMInfoMultiSystemPCIeAddrInfoRsp
function TSetFDMInfoMultiSystemPCIeAddrInfoRsp:init_from_obj(obj)
    self.CompletionCode = obj.CompletionCode
    self.ManufactureId = obj.ManufactureId
end

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

TSetFDMInfoMultiSystemPCIeAddrInfoRsp.from_obj = TSetFDMInfoMultiSystemPCIeAddrInfoRsp_from_obj

TSetFDMInfoMultiSystemPCIeAddrInfoRsp.proto_property = {'CompletionCode', 'ManufactureId'}

TSetFDMInfoMultiSystemPCIeAddrInfoRsp.default = {0, 0}

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

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

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

function TSetFDMInfoMultiSystemPCIeAddrInfoRsp:unpack(_)
    return self.CompletionCode, self.ManufactureId
end

SetFDMInfoMultiSystemPCIeAddrInfo.SetFDMInfoMultiSystemPCIeAddrInfoRsp = TSetFDMInfoMultiSystemPCIeAddrInfoRsp

return SetFDMInfoMultiSystemPCIeAddrInfo
