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

---@class MDPUCardHotplug.HotplugNotify
---@field HotplugNotify integer
local THotplugNotify = {}
THotplugNotify.__index = THotplugNotify
THotplugNotify.group = {}

local function THotplugNotify_from_obj(obj)
    return setmetatable(obj, THotplugNotify)
end

function THotplugNotify.new(HotplugNotify)
    return THotplugNotify_from_obj({HotplugNotify = HotplugNotify})
end
---@param obj MDPUCardHotplug.HotplugNotify
function THotplugNotify:init_from_obj(obj)
    self.HotplugNotify = obj.HotplugNotify
end

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

THotplugNotify.from_obj = THotplugNotify_from_obj

THotplugNotify.proto_property = {'HotplugNotify'}

THotplugNotify.default = {0}

THotplugNotify.struct = {{name = 'HotplugNotify', is_array = false, struct = nil}}

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

    validate.Optional(prefix .. 'HotplugNotify', self.HotplugNotify, 'uint32', false, errs, need_convert)

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

function THotplugNotify:unpack(_)
    return self.HotplugNotify
end

MDPUCardHotplug.HotplugNotify = THotplugNotify

return MDPUCardHotplug
