import { Schema } from "mongoose";
import { applyIdTransform, registerModel, stringId } from "../schema";

const WalletSchema = new Schema(
  {
    _id: stringId,
    userId: { type: String, ref: "User", required: true, unique: true, index: true },
    balanceLyd: { type: Number, default: 0 },
  },
  { timestamps: true },
);

applyIdTransform(WalletSchema);

export const Wallet = registerModel("Wallet", WalletSchema);
