--[[-- 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 GetPOH = {}

---@class fructrl.GetPOHReq
local TGetPOHReq = {}
TGetPOHReq.__index = TGetPOHReq
TGetPOHReq.group = {}

local function TGetPOHReq_from_obj(obj)
    return setmetatable(obj, TGetPOHReq)
end

function TGetPOHReq.new()
    return TGetPOHReq_from_obj({})
end
---@param obj fructrl.GetPOHReq
function TGetPOHReq:init_from_obj(obj)

end

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

TGetPOHReq.from_obj = TGetPOHReq_from_obj

TGetPOHReq.proto_property = {}

TGetPOHReq.default = {}

TGetPOHReq.struct = {}

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

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

function TGetPOHReq:unpack(_)
end

GetPOH.GetPOHReq = TGetPOHReq

---@class fructrl.GetPOHRsp
---@field CompletionCode integer
---@field MinutesPerCount integer
---@field Counter integer
local TGetPOHRsp = {}
TGetPOHRsp.__index = TGetPOHRsp
TGetPOHRsp.group = {}

local function TGetPOHRsp_from_obj(obj)
    return setmetatable(obj, TGetPOHRsp)
end

function TGetPOHRsp.new(CompletionCode, MinutesPerCount, Counter)
    return TGetPOHRsp_from_obj({CompletionCode = CompletionCode, MinutesPerCount = MinutesPerCount, Counter = Counter})
end
---@param obj fructrl.GetPOHRsp
function TGetPOHRsp:init_from_obj(obj)
    self.CompletionCode = obj.CompletionCode
    self.MinutesPerCount = obj.MinutesPerCount
    self.Counter = obj.Counter
end

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

TGetPOHRsp.from_obj = TGetPOHRsp_from_obj

TGetPOHRsp.proto_property = {'CompletionCode', 'MinutesPerCount', 'Counter'}

TGetPOHRsp.default = {0, 0, 0}

TGetPOHRsp.struct = {
    {name = 'CompletionCode', is_array = false, struct = nil},
    {name = 'MinutesPerCount', is_array = false, struct = nil}, {name = 'Counter', is_array = false, struct = nil}
}

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

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

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

function TGetPOHRsp:unpack(_)
    return self.CompletionCode, self.MinutesPerCount, self.Counter
end

GetPOH.GetPOHRsp = TGetPOHRsp

return GetPOH
