import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
import { SeasonTypeEntity } from '../../domain/entities/season-type.entity';
import { Column, Entity, OneToMany } from 'typeorm';
import { BaseStatusModel } from 'src/core/modules/data/model/base-status.model';
import { SeasonPeriodModel } from 'src/modules/season-related/season-period/data/models/season-period.model';

@Entity(TABLE_NAME.SEASON_TYPE)
export class SeasonTypeModel
  extends BaseStatusModel<SeasonTypeEntity>
  implements SeasonTypeEntity
{
  @Column('varchar', { name: 'name' })
  name: string;

  @OneToMany(() => SeasonPeriodModel, (model) => model.season_type, {
    onDelete: 'CASCADE',
    onUpdate: 'CASCADE',
  })
  season_periods: SeasonPeriodModel[];
}
