import { DataTypes } from 'sequelize';
import sequelize from '../database.js';
import DiaryDate from './DiaryDates.js';
import { DiaryTag } from './DiaryTag.js';  // Benannter Import

const DiaryDateTag = sequelize.define('DiaryDateTag', {
    diaryDateId: {
        type: DataTypes.INTEGER,
        references: {
            model: DiaryDate,
            key: 'id',
        },
        onDelete: 'CASCADE',
    },
    tagId: {
        type: DataTypes.INTEGER,
        references: {
            model: DiaryTag,
            key: 'id',
        },
        onDelete: 'CASCADE',
    },
}, {
    underscored: true,
    tableName: 'diary_date_tags',
    timestamps: true,
});

export default DiaryDateTag;
