import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
import { StudentsEntity } from './Students.entity';
import { DB_SCHEMA } from 'src/utils';

@Entity('gender', { schema: DB_SCHEMA })
export class GenderEntity {
  @PrimaryGeneratedColumn({ type: 'tinyint', name: 'id' })
  id: boolean;

  @Column('varchar', { name: 'gender_name', length: 6 })
  gender_name: string;

  @Column('tinyint', { name: 'active', nullable: true, width: 1 })
  active: boolean | null;

  @Column('smallint', { name: 'by_user', nullable: true })
  by_user: number | null;

  @Column('timestamp', { name: 'created', default: () => 'CURRENT_TIMESTAMP' })
  created: Date;

  @Column('timestamp', { name: 'modified', default: () => 'CURRENT_TIMESTAMP' })
  modified: Date;

  @OneToMany(() => StudentsEntity, (students) => students.student_gender)
  students: StudentsEntity[];
}
