-- 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 MNetworkAdapterPreload = {}

---@class MNetworkAdapterPreload.Ref4PortConnector
---@field Ref4PortConnector integer[]
local TRef4PortConnector = {}
TRef4PortConnector.__index = TRef4PortConnector
TRef4PortConnector.group = {}

local function TRef4PortConnector_from_obj(obj)
    return setmetatable(obj, TRef4PortConnector)
end

function TRef4PortConnector.new(Ref4PortConnector)
    return TRef4PortConnector_from_obj({Ref4PortConnector = Ref4PortConnector})
end
---@param obj MNetworkAdapterPreload.Ref4PortConnector
function TRef4PortConnector:init_from_obj(obj)
    self.Ref4PortConnector = obj.Ref4PortConnector
end

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

TRef4PortConnector.from_obj = TRef4PortConnector_from_obj

TRef4PortConnector.proto_property = {'Ref4PortConnector'}

TRef4PortConnector.default = {{}}

TRef4PortConnector.struct = {{name = 'Ref4PortConnector', is_array = true, struct = nil}}

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

    validate.OptionalArray(prefix .. 'Ref4PortConnector', self.Ref4PortConnector, 'uint8', false, errs, need_convert)

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

function TRef4PortConnector:unpack(_)
    return self.Ref4PortConnector
end

MNetworkAdapterPreload.Ref4PortConnector = TRef4PortConnector

---@class MNetworkAdapterPreload.Ref2PortConnector
---@field Ref2PortConnector integer[]
local TRef2PortConnector = {}
TRef2PortConnector.__index = TRef2PortConnector
TRef2PortConnector.group = {}

local function TRef2PortConnector_from_obj(obj)
    return setmetatable(obj, TRef2PortConnector)
end

function TRef2PortConnector.new(Ref2PortConnector)
    return TRef2PortConnector_from_obj({Ref2PortConnector = Ref2PortConnector})
end
---@param obj MNetworkAdapterPreload.Ref2PortConnector
function TRef2PortConnector:init_from_obj(obj)
    self.Ref2PortConnector = obj.Ref2PortConnector
end

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

TRef2PortConnector.from_obj = TRef2PortConnector_from_obj

TRef2PortConnector.proto_property = {'Ref2PortConnector'}

TRef2PortConnector.default = {{}}

TRef2PortConnector.struct = {{name = 'Ref2PortConnector', is_array = true, struct = nil}}

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

    validate.OptionalArray(prefix .. 'Ref2PortConnector', self.Ref2PortConnector, 'uint8', false, errs, need_convert)

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

function TRef2PortConnector:unpack(_)
    return self.Ref2PortConnector
end

MNetworkAdapterPreload.Ref2PortConnector = TRef2PortConnector

return MNetworkAdapterPreload
