--[[-- 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-8-21
-- Description: DO NOT EDIT; Code generated by "ipmi_message.lua.mako"
]] --
local validate = require 'mc.validate'
local utils = require 'mc.utils'

local SetLdapDomain = {}

---@class IamIpmiCmds.SetLdapDomainReq
---@field ManufactureId integer
---@field Flag integer
---@field Reserved integer
---@field Offset integer
---@field Length integer
---@field Data string
local TSetLdapDomainReq = {}
TSetLdapDomainReq.__index = TSetLdapDomainReq
TSetLdapDomainReq.group = {}

local function TSetLdapDomainReq_from_obj(obj)
    return setmetatable(obj, TSetLdapDomainReq)
end

function TSetLdapDomainReq.new(ManufactureId, Flag, Reserved, Offset, Length, Data)
    return TSetLdapDomainReq_from_obj({
        ManufactureId = ManufactureId,
        Flag = Flag,
        Reserved = Reserved,
        Offset = Offset,
        Length = Length,
        Data = Data
    })
end
---@param obj IamIpmiCmds.SetLdapDomainReq
function TSetLdapDomainReq:init_from_obj(obj)
    self.ManufactureId = obj.ManufactureId
    self.Flag = obj.Flag
    self.Reserved = obj.Reserved
    self.Offset = obj.Offset
    self.Length = obj.Length
    self.Data = obj.Data
end

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

TSetLdapDomainReq.from_obj = TSetLdapDomainReq_from_obj

TSetLdapDomainReq.proto_property = {'ManufactureId', 'Flag', 'Reserved', 'Offset', 'Length', 'Data'}

TSetLdapDomainReq.default = {0, 0, 0, 0, 0, ''}

TSetLdapDomainReq.struct = {
    {name = 'ManufactureId', is_array = false, struct = nil}, {name = 'Flag', is_array = false, struct = nil},
    {name = 'Reserved', is_array = false, struct = nil}, {name = 'Offset', is_array = false, struct = nil},
    {name = 'Length', is_array = false, struct = nil}, {name = 'Data', is_array = false, struct = nil}
}

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

    validate.Optional(prefix .. 'ManufactureId', self.ManufactureId, 'uint32', false, errs, need_convert)
    validate.Optional(prefix .. 'Flag', self.Flag, 'uint8', false, errs, need_convert)
    validate.Optional(prefix .. 'Reserved', self.Reserved, 'uint8', false, errs, need_convert)
    validate.Optional(prefix .. 'Offset', self.Offset, 'uint8', false, errs, need_convert)
    validate.Optional(prefix .. 'Length', self.Length, 'uint8', false, errs, need_convert)
    validate.Optional(prefix .. 'Data', self.Data, 'string', false, errs, need_convert)

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

function TSetLdapDomainReq:unpack(_)
    return self.ManufactureId, self.Flag, self.Reserved, self.Offset, self.Length, self.Data
end

SetLdapDomain.SetLdapDomainReq = TSetLdapDomainReq

---@class IamIpmiCmds.SetLdapDomainRsp
---@field CompletionCode integer
---@field ManufactureId integer
local TSetLdapDomainRsp = {}
TSetLdapDomainRsp.__index = TSetLdapDomainRsp
TSetLdapDomainRsp.group = {}

local function TSetLdapDomainRsp_from_obj(obj)
    return setmetatable(obj, TSetLdapDomainRsp)
end

function TSetLdapDomainRsp.new(CompletionCode, ManufactureId)
    return TSetLdapDomainRsp_from_obj({CompletionCode = CompletionCode, ManufactureId = ManufactureId})
end
---@param obj IamIpmiCmds.SetLdapDomainRsp
function TSetLdapDomainRsp:init_from_obj(obj)
    self.CompletionCode = obj.CompletionCode
    self.ManufactureId = obj.ManufactureId
end

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

TSetLdapDomainRsp.from_obj = TSetLdapDomainRsp_from_obj

TSetLdapDomainRsp.proto_property = {'CompletionCode', 'ManufactureId'}

TSetLdapDomainRsp.default = {0, 0}

TSetLdapDomainRsp.struct = {
    {name = 'CompletionCode', is_array = false, struct = nil}, {name = 'ManufactureId', is_array = false, struct = nil}
}

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

    validate.Optional(prefix .. 'CompletionCode', self.CompletionCode, 'uint8', false, errs, need_convert)
    validate.Optional(prefix .. 'ManufactureId', self.ManufactureId, 'uint32', false, errs, need_convert)

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

function TSetLdapDomainRsp:unpack(_)
    return self.CompletionCode, self.ManufactureId
end

SetLdapDomain.SetLdapDomainRsp = TSetLdapDomainRsp

return SetLdapDomain
