import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { WorkCharacter } from './work-character';

@Entity()
export class WorkCharacterName implements IIdentifiableEntity, INameEntity {
  @PrimaryGeneratedColumn()
  public id!: number;

  @ManyToOne(() => WorkCharacter, (workCharacter: WorkCharacter) => workCharacter.names, {
    nullable: false,
    onDelete: 'CASCADE',
    onUpdate: 'CASCADE',
  })
  public entity!: Promise<WorkCharacter>;

  @Column({
    nullable: false,
    default: '',
  })
  public name!: string;
}
