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

@Entity()
export class Language extends BaseEntity {
  @Column({
    nullable: false,
    unique: true,
  })
  public code: string;

  @ManyToMany(() => Copy, {
    nullable: false,
    onDelete: 'CASCADE',
    onUpdate: 'CASCADE',
  })
  public copies: Promise<Copy[]>;
}
