import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
import { EmergencyCallResponseEntity } from './emergency-call-response.entity';

@Entity('emergency_calls')
export class EmergencyCallEntity {
    @PrimaryGeneratedColumn() id: number;
    @Column() character_id: number;
    @Column({ type: 'varchar', length: 32 }) character_name: string;
    @Column({ type: 'varchar', length: 32 }) phone_number: string;
    @Column({ type: 'varchar', length: 128 }) location: string;
    @Column({ type: 'text' }) emergency: string;
    @Column({ type: 'tinyint', width: 1 }) police: boolean;
    @Column({ type: 'tinyint', width: 1 }) fire: boolean;
    @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) date: Date;

    @OneToMany(() => EmergencyCallResponseEntity, (responder) => responder.emergency_call)
    responders?: EmergencyCallResponseEntity[];
}
