const mongoose = require("mongoose");

const TokenSchema = mongoose.Schema(
  {
    name: {
      type: String,
      required: [true, "Token name is required"],
      unique: true,
    },
    symbol: {
      type: String,
      required: [true, "Token symbol is required"],
      unique: true,
    },
    description: {
      type: String,
    },
    web: { type: String },
    telegram: { type: String },
    userId: {
      type: mongoose.Schema.Types.ObjectId,
      ref: "User",
      required: true,
    },
    x: { type: String },
    image_url: { type: String },
    tokenAddress: { type: String, required: true, unique: true },
    userAddress: { type: String, required: true }, // No unique constraint
    status: { type: String, default: "unused" }, // or a boolean `used`
    assignedBotUuid: { type: String, default: null }, // No unique constraint
  },
  {
    timestamps: true,
  }
);

const Token = mongoose.model("Token", TokenSchema);

module.exports = Token;
