import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
import WeatherType from '../type/weather.js';

class Production extends Model { }

Production.init({
    branchId: {
        type: DataTypes.INTEGER,
        allowNull: false},
    productId: {
        type: DataTypes.INTEGER,
        allowNull: false},
    quantity: {
        type: DataTypes.INTEGER,
        allowNull: false},
    weatherTypeId: {
        type: DataTypes.INTEGER,
        allowNull: true,
        comment: 'Wetter zum Zeitpunkt der Produktionserstellung'
    },
    startTimestamp: {
        type: DataTypes.DATE,
        allowNull: false,
        defaultValue: sequelize.literal('CURRENT_TIMESTAMP')}
}, {
    sequelize,
    modelName: 'Production',
    tableName: 'production',
    schema: 'falukant_data',
    timestamps: false,
    underscored: true});

export default Production;
