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

---@class MUpgradedDrivesPendingActive.DriveName
---@field DriveName string
local TDriveName = {}
TDriveName.__index = TDriveName
TDriveName.group = {}

local function TDriveName_from_obj(obj)
    return setmetatable(obj, TDriveName)
end

function TDriveName.new(DriveName)
    return TDriveName_from_obj({DriveName = DriveName or [=[N/A]=]})
end
---@param obj MUpgradedDrivesPendingActive.DriveName
function TDriveName:init_from_obj(obj)
    self.DriveName = obj.DriveName or [=[N/A]=]
end

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

TDriveName.from_obj = TDriveName_from_obj

TDriveName.proto_property = {'DriveName'}

TDriveName.default = {''}

TDriveName.struct = {{name = 'DriveName', is_array = false, struct = nil}}

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

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

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

function TDriveName:unpack(_)
    return self.DriveName
end

MUpgradedDrivesPendingActive.DriveName = TDriveName

return MUpgradedDrivesPendingActive
