-- 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 validate = require 'mc.validate'
local utils = require 'mc.utils'

local MACCycle = {}

---@class MACCycle.ACWpValue
---@field ACWpValue integer
local TACWpValue = {}
TACWpValue.__index = TACWpValue
TACWpValue.group = {}

local function TACWpValue_from_obj(obj)
    return setmetatable(obj, TACWpValue)
end

function TACWpValue.new(ACWpValue)
    return TACWpValue_from_obj({ACWpValue = ACWpValue})
end
---@param obj MACCycle.ACWpValue
function TACWpValue:init_from_obj(obj)
    self.ACWpValue = obj.ACWpValue
end

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

TACWpValue.from_obj = TACWpValue_from_obj

TACWpValue.proto_property = {'ACWpValue'}

TACWpValue.default = {0}

TACWpValue.struct = {{name = 'ACWpValue', is_array = false, struct = nil}}

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

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

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

function TACWpValue:unpack(_)
    return self.ACWpValue
end

MACCycle.ACWpValue = TACWpValue

---@class MACCycle.ACWp
---@field ACWp integer
local TACWp = {}
TACWp.__index = TACWp
TACWp.group = {}

local function TACWp_from_obj(obj)
    return setmetatable(obj, TACWp)
end

function TACWp.new(ACWp)
    return TACWp_from_obj({ACWp = ACWp})
end
---@param obj MACCycle.ACWp
function TACWp:init_from_obj(obj)
    self.ACWp = obj.ACWp
end

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

TACWp.from_obj = TACWp_from_obj

TACWp.proto_property = {'ACWp'}

TACWp.default = {0}

TACWp.struct = {{name = 'ACWp', is_array = false, struct = nil}}

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

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

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

function TACWp:unpack(_)
    return self.ACWp
end

MACCycle.ACWp = TACWp

---@class MACCycle.ACValue
---@field ACValue integer
local TACValue = {}
TACValue.__index = TACValue
TACValue.group = {}

local function TACValue_from_obj(obj)
    return setmetatable(obj, TACValue)
end

function TACValue.new(ACValue)
    return TACValue_from_obj({ACValue = ACValue or 1})
end
---@param obj MACCycle.ACValue
function TACValue:init_from_obj(obj)
    self.ACValue = obj.ACValue or 1
end

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

TACValue.from_obj = TACValue_from_obj

TACValue.proto_property = {'ACValue'}

TACValue.default = {0}

TACValue.struct = {{name = 'ACValue', is_array = false, struct = nil}}

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

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

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

function TACValue:unpack(_)
    return self.ACValue
end

MACCycle.ACValue = TACValue

---@class MACCycle.AC
---@field AC integer
local TAC = {}
TAC.__index = TAC
TAC.group = {}

local function TAC_from_obj(obj)
    return setmetatable(obj, TAC)
end

function TAC.new(AC)
    return TAC_from_obj({AC = AC})
end
---@param obj MACCycle.AC
function TAC:init_from_obj(obj)
    self.AC = obj.AC
end

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

TAC.from_obj = TAC_from_obj

TAC.proto_property = {'AC'}

TAC.default = {0}

TAC.struct = {{name = 'AC', is_array = false, struct = nil}}

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

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

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

function TAC:unpack(_)
    return self.AC
end

MACCycle.AC = TAC

return MACCycle
