import { DataTypes } from 'sequelize';

export default function defineOtpCode(sequelize) {
  return sequelize.define(
    'OtpCode',
    {
      id: { type: DataTypes.BIGINT.UNSIGNED, primaryKey: true, autoIncrement: true },
      phone: { type: DataTypes.STRING(20), allowNull: false },
      code: { type: DataTypes.STRING(10), allowNull: false },
      expires_at: { type: DataTypes.DATE(3), allowNull: false },
    },
    { tableName: 'otp_codes' }
  );
}
