import { Column, Entity, ManyToOne } from 'typeorm';
import { BaseEntity } from '../base-entity';
import { Copy } from './copy';

const enum CopyTypes {
  ORIGINAL = 'original',
  TRANSLATED = 'translated',
  UNCENSORED = 'uncensored',
  OTHER = 'other',
}

@Entity()
export class CopyType extends BaseEntity {
  @ManyToOne(
    () => Copy,
    (copy: Copy) => copy.types,
    {
      nullable: false,
      onDelete: 'CASCADE',
      onUpdate: 'CASCADE',
    }
  )
  public copy: Promise<Copy>;

  @Column({ nullable: false })
  public type: CopyTypes;

  @Column({ nullable: true })
  public comment: string;
}
