import {
  Table,
  Column,
  DataType,
  CreatedAt,
  UpdatedAt,
  Model,
  PrimaryKey,
  AutoIncrement,
  BelongsToMany,
  HasMany
} from "sequelize-typescript";
import Queue from "./Queue";
import QuickAnswerQueue from "./QuickAnswerQueue";

@Table
class QuickAnswer extends Model<QuickAnswer> {
  @PrimaryKey
  @AutoIncrement
  @Column
  id: number;

  @Column(DataType.TEXT)
  shortcut: string;

  @Column(DataType.TEXT)
  message: string;

  @CreatedAt
  createdAt: Date;

  @UpdatedAt
  updatedAt: Date;

  @BelongsToMany(() => Queue, () => QuickAnswerQueue)
  queues: Array<Queue & { QuickAnswerQueue: QuickAnswerQueue }>;

  @HasMany(() => QuickAnswerQueue)
  quickAnswerQueue: QuickAnswerQueue[];
}

export default QuickAnswer;
