import mongoose from "mongoose";

const MessageSchema = new mongoose.Schema(
  {
    roomId: {
      type: String,
      required: true,
    }, // optional if you ever want to group conversations
    senderId: {
      type: mongoose.Schema.Types.ObjectId,
      ref: "User",
      required: true,
    },
    receiverId: {
      type: mongoose.Schema.Types.ObjectId,
      ref: "User",
      required: true,
    },
    message: { type: String, required: true },
    // mediaUrl: { type: String },
    // status: {
    //   type: String,
    //   enum: ["sent", "delivered", "read"],
    //   default: "sent",
    // },
  },
  { timestamps: true },
);

export default mongoose.model("Message", MessageSchema);
