import { IEntity } from "./IEntity";
import { IQuery } from "./IQuery";

export class TaskUpdate implements IEntity {
    id?: number;
    taskId: string;
    updateDate: Date;

    constructor(taskId: string, updateDate: Date, id?: number) {
        this.id = id;
        this.taskId = taskId;
        this.updateDate = new Date(updateDate);
    }
}

export const TaskUpdateQuery: IQuery = {
    tableName: "taskUpdates",
    tableQuery: `CREATE TABLE IF NOT EXISTS taskUpdates (
        id INTEGER PRIMARY KEY AUTOINCREMENT,
        taskId TEXT NOT NULL,
        updateDate TEXT NOT NULL,
        FOREIGN KEY (taskId) REFERENCES tasks(id)
    );`
};