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

---@class MNetworkAdapterController.PowerCtrlReg
---@field PowerCtrlReg integer
local TPowerCtrlReg = {}
TPowerCtrlReg.__index = TPowerCtrlReg
TPowerCtrlReg.group = {}

local function TPowerCtrlReg_from_obj(obj)
    return setmetatable(obj, TPowerCtrlReg)
end

function TPowerCtrlReg.new(PowerCtrlReg)
    return TPowerCtrlReg_from_obj({PowerCtrlReg = PowerCtrlReg})
end
---@param obj MNetworkAdapterController.PowerCtrlReg
function TPowerCtrlReg:init_from_obj(obj)
    self.PowerCtrlReg = obj.PowerCtrlReg
end

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

TPowerCtrlReg.from_obj = TPowerCtrlReg_from_obj

TPowerCtrlReg.proto_property = {'PowerCtrlReg'}

TPowerCtrlReg.default = {0}

TPowerCtrlReg.struct = {{name = 'PowerCtrlReg', is_array = false, struct = nil}}

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

    validate.Optional(prefix .. 'PowerCtrlReg', self.PowerCtrlReg, 'uint8', false, errs, need_convert)

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

function TPowerCtrlReg:unpack(_)
    return self.PowerCtrlReg
end

MNetworkAdapterController.PowerCtrlReg = TPowerCtrlReg

---@class MNetworkAdapterController.ResetReg
---@field ResetReg integer
local TResetReg = {}
TResetReg.__index = TResetReg
TResetReg.group = {}

local function TResetReg_from_obj(obj)
    return setmetatable(obj, TResetReg)
end

function TResetReg.new(ResetReg)
    return TResetReg_from_obj({ResetReg = ResetReg})
end
---@param obj MNetworkAdapterController.ResetReg
function TResetReg:init_from_obj(obj)
    self.ResetReg = obj.ResetReg
end

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

TResetReg.from_obj = TResetReg_from_obj

TResetReg.proto_property = {'ResetReg'}

TResetReg.default = {0}

TResetReg.struct = {{name = 'ResetReg', is_array = false, struct = nil}}

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

    validate.Optional(prefix .. 'ResetReg', self.ResetReg, 'uint8', false, errs, need_convert)

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

function TResetReg:unpack(_)
    return self.ResetReg
end

MNetworkAdapterController.ResetReg = TResetReg

---@class MNetworkAdapterController.PowerState
---@field PowerState integer
local TPowerState = {}
TPowerState.__index = TPowerState
TPowerState.group = {}

local function TPowerState_from_obj(obj)
    return setmetatable(obj, TPowerState)
end

function TPowerState.new(PowerState)
    return TPowerState_from_obj({PowerState = PowerState})
end
---@param obj MNetworkAdapterController.PowerState
function TPowerState:init_from_obj(obj)
    self.PowerState = obj.PowerState
end

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

TPowerState.from_obj = TPowerState_from_obj

TPowerState.proto_property = {'PowerState'}

TPowerState.default = {0}

TPowerState.struct = {{name = 'PowerState', is_array = false, struct = nil}}

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

    validate.Optional(prefix .. 'PowerState', self.PowerState, 'uint8', false, errs, need_convert)

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

function TPowerState:unpack(_)
    return self.PowerState
end

MNetworkAdapterController.PowerState = TPowerState

---@class MNetworkAdapterController.NodeId
---@field NodeId string
local TNodeId = {}
TNodeId.__index = TNodeId
TNodeId.group = {}

local function TNodeId_from_obj(obj)
    return setmetatable(obj, TNodeId)
end

function TNodeId.new(NodeId)
    return TNodeId_from_obj({NodeId = NodeId})
end
---@param obj MNetworkAdapterController.NodeId
function TNodeId:init_from_obj(obj)
    self.NodeId = obj.NodeId
end

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

TNodeId.from_obj = TNodeId_from_obj

TNodeId.proto_property = {'NodeId'}

TNodeId.default = {''}

TNodeId.struct = {{name = 'NodeId', is_array = false, struct = nil}}

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

    validate.Required(prefix .. 'NodeId', self.NodeId, 'string', false, errs, need_convert)

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

function TNodeId:unpack(_)
    return self.NodeId
end

MNetworkAdapterController.NodeId = TNodeId

return MNetworkAdapterController
