import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { Site } from './site';

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

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

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