-- Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
--
-- this file licensed under the 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.
--
-- Author: auto generate
-- Create: 2025-3-15
-- Description: DO NOT EDIT; Code generated by "message.lua.mako"
local validate = require 'mc.validate'
local utils = require 'mc.utils'

local MLoginRule = {}

---@class MLoginRule.Enabled
---@field Enabled boolean
local TEnabled = {}
TEnabled.__index = TEnabled
TEnabled.group = {}

local function TEnabled_from_obj(obj) return setmetatable(obj, TEnabled) end

function TEnabled.new(Enabled)
    return TEnabled_from_obj({Enabled = Enabled or false})
end
---@param obj MLoginRule.Enabled
function TEnabled:init_from_obj(obj) self.Enabled = obj.Enabled or false end

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

TEnabled.from_obj = TEnabled_from_obj

TEnabled.proto_property = {'Enabled'}

TEnabled.default = {false}

TEnabled.struct = {{name = 'Enabled', is_array = false, struct = nil}}

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

    validate.Optional(prefix .. 'Enabled', self.Enabled, "bool", false, errs,
                      need_convert)

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

function TEnabled:unpack(_) return self.Enabled end

MLoginRule.Enabled = TEnabled

---@class MLoginRule.MacRule
---@field MacRule string
local TMacRule = {}
TMacRule.__index = TMacRule
TMacRule.group = {}

local function TMacRule_from_obj(obj) return setmetatable(obj, TMacRule) end

function TMacRule.new(MacRule) return TMacRule_from_obj({MacRule = MacRule}) end
---@param obj MLoginRule.MacRule
function TMacRule:init_from_obj(obj) self.MacRule = obj.MacRule end

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

TMacRule.from_obj = TMacRule_from_obj

TMacRule.proto_property = {'MacRule'}

TMacRule.default = {''}

TMacRule.struct = {{name = 'MacRule', is_array = false, struct = nil}}

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

    validate.Optional(prefix .. 'MacRule', self.MacRule, "string", false, errs,
                      need_convert)

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

function TMacRule:unpack(_) return self.MacRule end

MLoginRule.MacRule = TMacRule

---@class MLoginRule.TimeRule
---@field TimeRule string
local TTimeRule = {}
TTimeRule.__index = TTimeRule
TTimeRule.group = {}

local function TTimeRule_from_obj(obj) return setmetatable(obj, TTimeRule) end

function TTimeRule.new(TimeRule) return
    TTimeRule_from_obj({TimeRule = TimeRule}) end
---@param obj MLoginRule.TimeRule
function TTimeRule:init_from_obj(obj) self.TimeRule = obj.TimeRule end

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

TTimeRule.from_obj = TTimeRule_from_obj

TTimeRule.proto_property = {'TimeRule'}

TTimeRule.default = {''}

TTimeRule.struct = {{name = 'TimeRule', is_array = false, struct = nil}}

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

    validate.Optional(prefix .. 'TimeRule', self.TimeRule, "string", false,
                      errs, need_convert)

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

function TTimeRule:unpack(_) return self.TimeRule end

MLoginRule.TimeRule = TTimeRule

---@class MLoginRule.Ipv6Rule
---@field Ipv6Rule string
local TIpv6Rule = {}
TIpv6Rule.__index = TIpv6Rule
TIpv6Rule.group = {}

local function TIpv6Rule_from_obj(obj) return setmetatable(obj, TIpv6Rule) end

function TIpv6Rule.new(Ipv6Rule)
    return TIpv6Rule_from_obj({Ipv6Rule = Ipv6Rule or [=[]=]})
end
---@param obj MLoginRule.Ipv6Rule
function TIpv6Rule:init_from_obj(obj) self.Ipv6Rule = obj.Ipv6Rule or [=[]=] end

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

TIpv6Rule.from_obj = TIpv6Rule_from_obj

TIpv6Rule.proto_property = {'Ipv6Rule'}

TIpv6Rule.default = {''}

TIpv6Rule.struct = {{name = 'Ipv6Rule', is_array = false, struct = nil}}

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

    validate.Optional(prefix .. 'Ipv6Rule', self.Ipv6Rule, "string", false,
                      errs, need_convert)

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

function TIpv6Rule:unpack(_) return self.Ipv6Rule end

MLoginRule.Ipv6Rule = TIpv6Rule

---@class MLoginRule.IpRule
---@field IpRule string
local TIpRule = {}
TIpRule.__index = TIpRule
TIpRule.group = {}

local function TIpRule_from_obj(obj) return setmetatable(obj, TIpRule) end

function TIpRule.new(IpRule) return TIpRule_from_obj({IpRule = IpRule}) end
---@param obj MLoginRule.IpRule
function TIpRule:init_from_obj(obj) self.IpRule = obj.IpRule end

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

TIpRule.from_obj = TIpRule_from_obj

TIpRule.proto_property = {'IpRule'}

TIpRule.default = {''}

TIpRule.struct = {{name = 'IpRule', is_array = false, struct = nil}}

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

    validate.Optional(prefix .. 'IpRule', self.IpRule, "string", false, errs,
                      need_convert)

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

function TIpRule:unpack(_) return self.IpRule end

MLoginRule.IpRule = TIpRule

---@class MLoginRule.RuleId
---@field RuleId integer
local TRuleId = {}
TRuleId.__index = TRuleId
TRuleId.group = {}

local function TRuleId_from_obj(obj) return setmetatable(obj, TRuleId) end

function TRuleId.new(RuleId) return TRuleId_from_obj({RuleId = RuleId}) end
---@param obj MLoginRule.RuleId
function TRuleId:init_from_obj(obj) self.RuleId = obj.RuleId end

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

TRuleId.from_obj = TRuleId_from_obj

TRuleId.proto_property = {'RuleId'}

TRuleId.default = {0}

TRuleId.struct = {{name = 'RuleId', is_array = false, struct = nil}}

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

    validate.Required(prefix .. 'RuleId', self.RuleId, "uint8", false, errs,
                      need_convert)

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

function TRuleId:unpack(_) return self.RuleId end

MLoginRule.RuleId = TRuleId

return MLoginRule
