// Copyright (c) ONNX Project Contributors
//
// SPDX-License-Identifier: Apache-2.0

#include "onnx_op/operator_sets.h"

#include "onnx_op/operator_sets_controlflow.h"
#include "onnx_op/operator_sets_generator.h"
#include "onnx_op/operator_sets_image.h"
#include "onnx_op/operator_sets_logical.h"
#include "onnx_op/operator_sets_math.h"
#include "onnx_op/operator_sets_nn.h"
#include "onnx_op/operator_sets_object_detection.h"
#include "onnx_op/operator_sets_optional.h"
#include "onnx_op/operator_sets_preview.h"
#include "onnx_op/operator_sets_quantization.h"
#include "onnx_op/operator_sets_reduction.h"
#include "onnx_op/operator_sets_rt.h"
#include "onnx_op/operator_sets_sequence.h"
#include "onnx_op/operator_sets_tensor.h"
#include "onnx_op/operator_sets_text.h"
#include "onnx_op/operator_sets_traditionalml.h"
#include "onnx_op/operator_sets_training.h"

namespace ONNX_LIGHT_NAMESPACE::onnx_op {

std::vector<LightOpSchema> GetAllOnnxOpSchemasWithHistory(const std::string &op_type,
                                                          bool init_doc) {
  const std::vector<LightOpSchema> controlflow_schemas =
      controlflow::GetAllOnnxOpControlflowSchemasWithHistory(op_type, init_doc);
  const std::vector<LightOpSchema> generator_schemas =
      generator::GetAllOnnxOpGeneratorSchemasWithHistory(op_type, init_doc);
  const std::vector<LightOpSchema> image_schemas =
      image::GetAllOnnxOpImageSchemasWithHistory(op_type, init_doc);
  const std::vector<LightOpSchema> math_schemas =
      math::GetAllOnnxOpMathSchemasWithHistory(op_type, init_doc);
  const std::vector<LightOpSchema> logical_schemas =
      logical::GetAllOnnxOpLogicalSchemasWithHistory(op_type, init_doc);
  const std::vector<LightOpSchema> nn_schemas =
      nn::GetAllOnnxOpNnSchemasWithHistory(op_type, init_doc);
  const std::vector<LightOpSchema> object_detection_schemas =
      object_detection::GetAllOnnxOpObjectDetectionSchemasWithHistory(op_type, init_doc);
  const std::vector<LightOpSchema> optional_schemas =
      optional::GetAllOnnxOpOptionalSchemasWithHistory(op_type, init_doc);
  const std::vector<LightOpSchema> preview_schemas =
      preview::GetAllOnnxOpPreviewSchemasWithHistory(op_type, init_doc);
  const std::vector<LightOpSchema> quantization_schemas =
      quantization::GetAllOnnxOpQuantizationSchemasWithHistory(op_type, init_doc);
  const std::vector<LightOpSchema> reduction_schemas =
      reduction::GetAllOnnxOpReductionSchemasWithHistory(op_type, init_doc);
  const std::vector<LightOpSchema> rt_schemas =
      rt::GetAllOnnxOpRtSchemasWithHistory(op_type, init_doc);
  const std::vector<LightOpSchema> sequence_schemas =
      sequence::GetAllOnnxOpSequenceSchemasWithHistory(op_type, init_doc);
  const std::vector<LightOpSchema> tensor_schemas =
      tensor::GetAllOnnxOpTensorSchemasWithHistory(op_type, init_doc);
  const std::vector<LightOpSchema> text_schemas =
      text::GetAllOnnxOpTextSchemasWithHistory(op_type, init_doc);
  const std::vector<LightOpSchema> traditionalml_schemas =
      traditionalml::GetAllOnnxOpTraditionalMLSchemasWithHistory(op_type, init_doc);
  const std::vector<LightOpSchema> training_schemas =
      training::GetAllOnnxOpTrainingSchemasWithHistory(op_type, init_doc);

  std::vector<LightOpSchema> all_schemas;
  all_schemas.reserve(controlflow_schemas.size() + generator_schemas.size() + image_schemas.size() +
                      math_schemas.size() + logical_schemas.size() + nn_schemas.size() +
                      object_detection_schemas.size() + optional_schemas.size() +
                      preview_schemas.size() + quantization_schemas.size() +
                      reduction_schemas.size() + rt_schemas.size() + sequence_schemas.size() +
                      tensor_schemas.size() + text_schemas.size() + traditionalml_schemas.size() +
                      training_schemas.size());

  all_schemas.insert(all_schemas.end(), controlflow_schemas.begin(), controlflow_schemas.end());
  all_schemas.insert(all_schemas.end(), generator_schemas.begin(), generator_schemas.end());
  all_schemas.insert(all_schemas.end(), image_schemas.begin(), image_schemas.end());
  all_schemas.insert(all_schemas.end(), logical_schemas.begin(), logical_schemas.end());
  all_schemas.insert(all_schemas.end(), math_schemas.begin(), math_schemas.end());
  all_schemas.insert(all_schemas.end(), nn_schemas.begin(), nn_schemas.end());
  all_schemas.insert(all_schemas.end(), object_detection_schemas.begin(),
                     object_detection_schemas.end());
  all_schemas.insert(all_schemas.end(), optional_schemas.begin(), optional_schemas.end());
  all_schemas.insert(all_schemas.end(), preview_schemas.begin(), preview_schemas.end());
  all_schemas.insert(all_schemas.end(), quantization_schemas.begin(), quantization_schemas.end());
  all_schemas.insert(all_schemas.end(), reduction_schemas.begin(), reduction_schemas.end());
  all_schemas.insert(all_schemas.end(), rt_schemas.begin(), rt_schemas.end());
  all_schemas.insert(all_schemas.end(), sequence_schemas.begin(), sequence_schemas.end());
  all_schemas.insert(all_schemas.end(), tensor_schemas.begin(), tensor_schemas.end());
  all_schemas.insert(all_schemas.end(), text_schemas.begin(), text_schemas.end());
  all_schemas.insert(all_schemas.end(), traditionalml_schemas.begin(), traditionalml_schemas.end());
  all_schemas.insert(all_schemas.end(), training_schemas.begin(), training_schemas.end());

  return all_schemas;
}

} // namespace ONNX_LIGHT_NAMESPACE::onnx_op
