import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
import { VipCategoryEntity } from '../../domain/entities/vip-category.entity';
import { Column, Entity, OneToMany } from 'typeorm';
import { BaseStatusModel } from 'src/core/modules/data/model/base-status.model';
import { VipCodeModel } from 'src/modules/transaction/vip-code/data/models/vip-code.model';

@Entity(TABLE_NAME.VIP_CATEGORY)
export class VipCategoryModel
  extends BaseStatusModel<VipCategoryEntity>
  implements VipCategoryEntity
{
  @Column('varchar', { name: 'name' })
  name: string;

  @Column('boolean', { default: false })
  has_vip_pass: boolean;

  @OneToMany(() => VipCodeModel, (model) => model.vip_category, {
    cascade: true,
    onDelete: 'CASCADE',
    onUpdate: 'CASCADE',
  })
  vip_codes: VipCodeModel[];
}
