import { DataTypes } from "sequelize";

export default (sequelize) => {
  const Currency = sequelize.define("Currency", {
    id: {
      type: DataTypes.UUID,
      defaultValue: DataTypes.UUIDV4,
      primaryKey: true,
    },
    code: {
      type: DataTypes.STRING(10),
      allowNull: false,
      unique: true,
      comment: "Currency ISO code, e.g., NGN, USD",
    },
    name: {
      type: DataTypes.STRING,
      allowNull: false,
      comment: "Full currency name, e.g., Nigerian Naira",
    },
    symbol: {
      type: DataTypes.STRING(10),
      allowNull: true,
      comment: "Currency symbol, e.g., ₦, $",
    },
    status: {
      type: DataTypes.ENUM("active", "inactive"),
      defaultValue: "active",
      allowNull: false,
    },
    virtualAccountStatus: {
      type: DataTypes.ENUM("active", "inactive"),
      defaultValue: "inactive",
      allowNull: false,
      comment: "Whether merchants should get a wallet in this currency (separate from the currency's general 'status').",
    },
  }, {
    tableName: "Currencies",
    timestamps: true,
  });

  return Currency;
};
