/**
 * Copyright (c) 2026 Huawei Technologies Co., Ltd.
 * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
 * CANN Open Software License Agreement Version 2.0 (the "License").
 * Please refer to the License for details. You may not use this file except in compliance with the License.
 * 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 FITNESS FOR A PARTICULAR PURPOSE.
 * See LICENSE in the root of the software repository for the full text of the License.
 */

#include "mdl_wrap.h"

namespace {
PyMethodDef g_methodsMdl[] = {
    {"load_from_file", WrapAclMdlLoadFromFile, METH_VARARGS, "mdl load from file"},
    {"unload", WrapAclMdlUnload, METH_VARARGS, "mdl unload"},
    {"query_size", WrapAclMdlQuerySize, METH_VARARGS, "mdl query size"},
    {"execute", WrapAclMdlExecute, METH_VARARGS, "mdl execute"},
    {"execute_async", WrapAclMdlExecuteAsync, METH_VARARGS, "mdl execute async"},
    {"create_dataset", WrapAclMdlCreateDataset, METH_VARARGS, "mdl create dataset"},
    {"destroy_dataset", WrapAclMdlDestroyDataset, METH_VARARGS, "mdl destroy dataset"},
    {"get_dataset_buffer", WrapAclMdlGetDatasetBuffer, METH_VARARGS, "mdl get dataset buffer"},
    {"get_dataset_num_buffers", WrapAclMdlGetDatasetNumBuffers, METH_VARARGS, "mdl get dataset num buffers"},
    {"add_dataset_buffer", WrapAclMdlAddDatasetBuffer, METH_VARARGS, "mdl add dataset buffer"},
    {"get_output_size_by_index", WrapAclMdlGetOutputSizeByIndex, METH_VARARGS, "mdl get output size by index"},
    {"get_num_inputs", WrapAclMdlGetNumInputs, METH_VARARGS, "mdl get num inputs"},
    {"get_num_outputs", WrapAclMdlGetNumOutputs, METH_VARARGS, "mdl get num outputs"},
    {"get_input_size_by_index", WrapAclMdlGetInputSizeByIndex, METH_VARARGS, "mdl get input size by index"},
    {"create_desc", WrapAclMdlCreateDesc, METH_VARARGS, "mdl create desc"},
    {"get_desc", WrapAclMdlGetDesc, METH_VARARGS, "mdl get desc"},
    {"destroy_desc", WrapAclMdlDestroyDesc, METH_VARARGS, "mdl destroy desc"},
    {"load_from_mem", WrapAclMdlLoadFromMem, METH_VARARGS, "mdl load from mem"},
    {"load_from_file_with_mem", WrapAclMdlLoadFromFileWithMem, METH_VARARGS, "mdl load from file with mem"},
    {"load_from_mem_with_mem", WrapAclMdlLoadFromMemWithMem, METH_VARARGS, "mdl load from mem with mem"},
    {"query_size_from_mem", WrapAclMdlQuerySizeFromMem, METH_VARARGS, "mdl query size from mem"},
    {"set_dynamic_batch_size", WrapAclMdlSetDynamicBatchSize, METH_VARARGS, "mdl set dynamic batch size"},
    {"set_dynamic_hw_size", WrapAclMdlSetDynamicHWSize, METH_VARARGS, "mdl set dynamic hw size"},
    {"get_cur_output_dims", WrapAclMdlGetCurOutputDims, METH_VARARGS, "mdl get cur num outputs"},
    {"get_first_aipp_info", WrapAclMdlGetFirstAippInfo, METH_VARARGS, "get first aipp info"},
    {"create_aipp", WrapAclMdlCreateAIPP, METH_VARARGS, "mdl create aipp"},
    {"destroy_aipp", WrapAclMdlDestroyAIPP, METH_VARARGS, "mdl destroy aipp"},
    {"get_input_dims", WrapAclMdlGetInputDims, METH_VARARGS, "mdl get input dims"},
    {"get_input_dims_v2", WrapAclMdlGetInputDimsV2, METH_VARARGS, "mdl get input dims v2"},
    {"get_output_dims", WrapAclMdlGetOutputDims, METH_VARARGS, "mdl get output dims"},
    {"get_input_name_by_index", WrapAclMdlGetInputNameByIndex, METH_VARARGS, "mdl get input name by index"},
    {"get_output_name_by_index", WrapAclMdlGetOutputNameByIndex, METH_VARARGS, "mdl get output name by index"},
    {"get_input_format", WrapAclMdlGetInputFormat, METH_VARARGS, "mdl get input format"},
    {"get_output_format", WrapAclMdlGetOutputFormat, METH_VARARGS, "mdl get output format"},
    {"get_input_data_type", WrapAclMdlGetInputDataType, METH_VARARGS, "mdl get input data type"},
    {"get_output_data_type", WrapAclMdlGetOutputDataType, METH_VARARGS, "mdl get output data type"},
    {"get_input_index_by_name", WrapAclMdlGetInputIndexByName, METH_VARARGS, "mdl get input index by name"},
    {"get_output_index_by_name", WrapAclMdlGetOutputIndexByName, METH_VARARGS, "mdl get Output index by name"},
    {"get_dynamic_batch", WrapAclMdlGetDynamicBatch, METH_VARARGS, "mdl get dynamic batch"},
    {"get_dynamic_hw", WrapAclMdlGetDynamicHW, METH_VARARGS, "mdl get dynamic hw"},
    {"set_aipp_input_format", WrapAclMdlSetAIPPInputFormat, METH_VARARGS, "mdl set aipp input format"},
    {"set_aipp_csc_params", WrapAclMdlSetAIPPCscParams, METH_VARARGS, "mdl set aipp csc params"},
    {"set_aipp_rbuv_swap_switch", WrapAclMdlSetAIPPRbuvSwapSwitch, METH_VARARGS, "mdl set aipp rbuv swap switch"},
    {"set_aipp_ax_swap_switch", WrapAclMdlSetAIPPAxSwapSwitch, METH_VARARGS, "mdl set aipp ax swap switch"},
    {"set_aipp_src_image_size", WrapAclMdlSetAIPPSrcImageSize, METH_VARARGS, "mdl set aipp src image size"},
    {"set_aipp_crop_params", WrapAclMdlSetAIPPCropParams, METH_VARARGS, "mdl set aipp crop params"},
    {"set_aipp_padding_params", WrapAclMdlSetAIPPPaddingParams, METH_VARARGS, "mdl set aipp padding params"},
    {"set_aipp_dtc_pixel_mean", WrapAclMdlSetAIPPDtcPixelMean, METH_VARARGS, "mdl set aipp dtc pixel mean"},
    {"set_aipp_dtc_pixel_min", WrapAclMdlSetAIPPDtcPixelMin, METH_VARARGS, "mdl set aipp dtc pixel min"},
    {"set_aipp_pixel_var_reci", WrapAclMdlSetAIPPPixelVarReci, METH_VARARGS, "mdl set aipp pixel var reci"},
    {"set_input_aipp", WrapAclMdlSetInputAIPP, METH_VARARGS, "mdl set input aipp"},
    {"set_input_dynamic_dims", WrapAclMdlSetInputDynamicDims, METH_VARARGS, "mdl set input dynamic dims"},
    {"get_input_dynamic_gear_count", WrapAclMdlGetInputDynamicGearCount, METH_VARARGS,
     "mdl get input dynamic gear count"},
    {"get_input_dynamic_dims", WrapAclMdlGetInputDynamicDims, METH_VARARGS, "mdl get input dynamic dims"},
    {"create_and_get_op_desc", WrapAclMdlCreateAndGetOpDesc, METH_VARARGS, "mdl create_and_get_op_desc"},
    {"init_dump", WrapAclMdlInitDump, METH_VARARGS, "mdl init dump"},
    {"finalize_dump", WrapAclMdlFinalizeDump, METH_VARARGS, "mdl finalize dump"},
    {"get_aipp_type", WrapAclMdlGetAippType, METH_VARARGS, "mdl get aipp type"},
    {"set_aipp_by_input_index", WrapAclMdlSetAIPPByInputIndex, METH_VARARGS, "mdl set aipp by input index"},
    {"set_dump", WrapAclMdlSetDump, METH_VARARGS, "mdl set dump"},
    {"dump_reg_callback", WrapAclMdlDumpRegCallback, METH_VARARGS, "dump reg callback"},
    {"dump_unreg_callback", WrapAclMdlDumpUnregCallback, METH_VARARGS, "dump unreg callback"},
    {"load_with_config", WrapAclMdlLoadWithConfig, METH_VARARGS, "load with config"},
    {"create_config_handle", WrapAclMdlCreateConfigHandle, METH_VARARGS, "create config handle"},
    {"destroy_config_handle", WrapAclMdlDestroyConfigHandle, METH_VARARGS, "destroy config handle"},
    {"set_config_opt", WrapAclMdlSetConfigOpt, METH_VARARGS, "set config opt"},
    {"get_tensor_real_name", WrapAclMdlGetTensorRealName, METH_VARARGS, "get tensor real name"},
    {"set_dataset_tensor_desc", WrapAclMdlSetDatasetTensorDesc, METH_VARARGS, "set dataset tensor desc"},
    {"get_dataset_tensor_desc", WrapAclMdlGetDatasetTensorDesc, METH_VARARGS, "get dataset tensor desc"},
    {"get_op_attr", WrapAclMdlGetOpAttr, METH_VARARGS, "get op attr"},
    {"get_aipp_data_size", WrapAclMdlGetAippDataSize, METH_VARARGS, "get aipp data size"},
    {"create_exec_config_handle", WrapAclMdlCreateExecConfigHandle, METH_VARARGS, "create mdlExecConfigHandle"},
    {"destroy_exec_config_handle", WrapAclMdlDestroyExecConfigHandle, METH_VARARGS, "destroy mdlExecConfigHandle"},
    {"set_exec_config_opt", WrapAclMdlSetExecConfigOpt, METH_VARARGS, "set mdlExecConfigHandle"},
    {"execute_v2", WrapAclMdlExecuteV2, METH_VARARGS, "execute model with mdlExecConfigHandle"},
    {"get_desc_from_file", WrapAclMdlGetDescFromFile, METH_VARARGS, "get desc from file"},
    {"get_desc_from_mem", WrapAclMdlGetDescFromMem, METH_VARARGS, "get desc from mem"},
    {"get_input_dims_range", WrapAclMdlGetInputDimsRange, METH_VARARGS, "get input dims range"},
    {"bundle_load_from_file", WrapAclMdlBundleLoadFromFile, METH_VARARGS, "bundle load from file"},
    {"bundle_load_from_mem", WrapAclMdlBundleLoadFromMem, METH_VARARGS, "bundle load from mem"},
    {"bundle_unload", WrapAclMdlBundleUnload, METH_VARARGS, "bundle unload"},
    {"bundle_get_model_id", WrapAclMdlBundleGetModelId, METH_VARARGS, "bundle get model id"},
    {"bundle_get_model_num", WrapAclMdlBundleGetModelNum, METH_VARARGS, "bundle get model num"},
#ifdef USE_MDL
    {"set_aipp_scf_params", WrapAclMdlSetAIPPScfParams, METH_VARARGS, "mdl set aipp scf params"},
    {"load_from_file_with_q", WrapAclMdlLoadFromFileWithQ, METH_VARARGS, "mdl load from file with q"},
    {"load_from_mem_with_q", WrapAclMdlLoadFromMemWithQ, METH_VARARGS, "mdl load from mem with q"},
#endif
    {nullptr, nullptr, 0, nullptr}};
} // namespace

PyMethodDef* GetMdlMethods() { return g_methodsMdl; }