import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';
import { Allow } from 'class-validator';
import { EntityHelper } from 'src/utils/entity-helper';
import { Team } from 'src/teams/entities/team.entity';
import { TeamSettingType } from 'src/teams/model/team-settings-type';

@Entity()
export class TeamSetting extends EntityHelper {
  @ApiProperty({ example: 0 })
  @PrimaryGeneratedColumn('increment')
  id: number;

  @Allow()
  @ApiProperty({ example: 0 })
  @ManyToOne(() => Team, (team) => team.settings)
  team: Team;

  @Column()
  key: TeamSettingType;

  @Column()
  value: string;
}
