'use strict';
const {
  Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
  class DailySales extends Model {
    /**
     * Helper method for defining associations.
     * This method is not a part of Sequelize lifecycle.
     * The `models/index` file will call this method automatically.
     */
    static associate(models) {
      // define association here
      DailySales.belongsTo(models.Store, { foreignKey: 'storeId', as: 'store' });
      DailySales.belongsTo(models.Register, { foreignKey: 'registerId', as: 'register' });
    }
  }
  DailySales.init({
    storeId: DataTypes.INTEGER,
    registerId: DataTypes.INTEGER,
    salesDate: DataTypes.DATE,
    totalTransactions: DataTypes.INTEGER,
    totalItems: DataTypes.INTEGER,
    grossSales: DataTypes.DECIMAL,
    discounts: DataTypes.DECIMAL,
    taxes: DataTypes.DECIMAL,
    netSales: DataTypes.DECIMAL,
    refunds: DataTypes.DECIMAL,
    cashSales: DataTypes.DECIMAL,
    cardSales: DataTypes.DECIMAL,
    mobilePayments: DataTypes.DECIMAL
  }, {
    sequelize,
    modelName: 'DailySales',
  });
  return DailySales;
};