import mongoose from "mongoose";

const ImageDetectionSchema = new mongoose.Schema(
  {
    cloudinaryUrl: { type: String, required: true },
    public_id: { type: String, required: true },
    uploadedBy: {
      type: mongoose.Schema.Types.ObjectId,
      ref: "User",
      required: true,
    },
    verification: {
      type: mongoose.Schema.Types.ObjectId,
      ref: "Verification",
    },
    prediction: {
      predicted_class: {
        type: String,
        required: true,
        enum: ["Karsinoma", "Kulit Sehat", "Melanoma"], // Add all possible classes
      },
      probabilities: {
        Karsinoma: { type: Number, required: true },
        Kulit_Sehat: { type: Number, required: true }, // Using underscore instead of space
        Melanoma: { type: Number, required: true },
      },
    },
    // detectionPercentage: {
    //   type: Number,
    //   min: 0.0,
    //   max: 100.0,
    //   default: 0.0,
    //   required: true,
    // },
  },
  { timestamps: true },
);

export default mongoose.model("ImageDetection", ImageDetectionSchema);
