-- Copyright (c) 2024 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 PCIeDeviceInterface = require 'mdb.bmc.kepler.Systems.PCIeDeviceInterface'

local childs = {}
local PCIeDevice = {childs = childs}

local Mdb = require 'mc.mdb'

local TPCIeDeviceInfo = Mdb.register_object(
    '/bmc/kepler/Systems/:SystemId/PCIeDevices/:PCIeDeviceId',
    {{name = 'Info', interface = PCIeDeviceInterface.IPCIeDeviceInfo}})
PCIeDevice.PCIeDeviceInfo = TPCIeDeviceInfo

function TPCIeDeviceInfo:ctor(SystemId, PCIeDeviceId)
    self.path = '/bmc/kepler/Systems/' .. SystemId .. '/PCIeDevices/' .. PCIeDeviceId .. ''
end

local TPcieAddrInfo = Mdb.register_object(
    '/bmc/kepler/Systems/:SystemID/PCIeDevices/PcieAddrInfo/:ID',
    {{name = 'PcieAddrInfo', interface = PCIeDeviceInterface.IPcieAddrInfo}})
PCIeDevice.PcieAddrInfo = TPcieAddrInfo

function TPcieAddrInfo:ctor(SystemID, ID)
    self.path = '/bmc/kepler/Systems/' .. SystemID .. '/PCIeDevices/PcieAddrInfo/' .. ID .. ''
end

local TUBConnector = Mdb.register_object(
    '/bmc/kepler/Systems/:SystemId/PCIeDevices/UBConnector/:ID',
    {{name = 'BizTopoNode', interface = PCIeDeviceInterface.BizTopoNode}})
PCIeDevice.UBConnector = TUBConnector

function TUBConnector:ctor(SystemId, ID)
    self.path = '/bmc/kepler/Systems/' .. SystemId .. '/PCIeDevices/UBConnector/' .. ID .. ''
end

local THiLink = Mdb.register_object('/bmc/kepler/Systems/:SystemId/PCIeDevices/HiLink/:ID', {
    {name = 'BizTopoNode', interface = PCIeDeviceInterface.BizTopoNode}
})
PCIeDevice.HiLink = THiLink

function THiLink:ctor(SystemId, ID)
    self.path = '/bmc/kepler/Systems/' .. SystemId .. '/PCIeDevices/HiLink/' .. ID .. ''
end

local TUnitConfig = Mdb.register_object('/bmc/kepler/Systems/:SystemId/PCIeDevices/UnitConfig/:ID',
    {{name = 'BizTopoNode', interface = PCIeDeviceInterface.BizTopoNode}})
PCIeDevice.UnitConfig = TUnitConfig

function TUnitConfig:ctor(SystemId, ID)
    self.path = '/bmc/kepler/Systems/' .. SystemId .. '/PCIeDevices/UnitConfig/' .. ID .. ''
end

local TSerdesModeConfig = Mdb.register_object(
    '/bmc/kepler/Systems/:SystemId/PCIeDevices/SerdesModeConfig/:ID',
    {{name = 'BizTopoNode', interface = PCIeDeviceInterface.BizTopoNode}})
PCIeDevice.SerdesModeConfig = TSerdesModeConfig

function TSerdesModeConfig:ctor(SystemId, ID)
    self.path = '/bmc/kepler/Systems/' .. SystemId .. '/PCIeDevices/SerdesModeConfig/' .. ID .. ''
end

return PCIeDevice
