'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface, Sequelize) {
    await queryInterface.createTable('Returns', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER
      },
      transactionId: {
        type: Sequelize.INTEGER
      },
      returnNumber: {
        type: Sequelize.STRING
      },
      customerId: {
        type: Sequelize.INTEGER
      },
      storeId: {
        type: Sequelize.INTEGER
      },
      registerId: {
        type: Sequelize.INTEGER
      },
      reason: {
        type: Sequelize.TEXT
      },
      returnType: {
        type: Sequelize.STRING
      },
      status: {
        type: Sequelize.STRING
      },
      subtotal: {
        type: Sequelize.DECIMAL
      },
      taxAmount: {
        type: Sequelize.DECIMAL
      },
      discountAmount: {
        type: Sequelize.DECIMAL
      },
      totalAmount: {
        type: Sequelize.DECIMAL
      },
      refundMethod: {
        type: Sequelize.STRING
      },
      refundAmount: {
        type: Sequelize.DECIMAL
      },
      restockingFee: {
        type: Sequelize.DECIMAL
      },
      processedBy: {
        type: Sequelize.INTEGER
      },
      processedAt: {
        type: Sequelize.DATE
      },
      approvedBy: {
        type: Sequelize.INTEGER
      },
      approvedAt: {
        type: Sequelize.DATE
      },
      rejectionReason: {
        type: Sequelize.TEXT
      },
      notes: {
        type: Sequelize.TEXT
      },
      receiptUrl: {
        type: Sequelize.STRING
      },
      isWithinReturnWindow: {
        type: Sequelize.BOOLEAN
      },
      daysFromPurchase: {
        type: Sequelize.INTEGER
      },
      createdAt: {
        allowNull: false,
        type: Sequelize.DATE
      },
      updatedAt: {
        allowNull: false,
        type: Sequelize.DATE
      }
    });
  },
  async down(queryInterface, Sequelize) {
    await queryInterface.dropTable('Returns');
  }
};