import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { Tag } from './tag';

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

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

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