import { Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm';
import { WeaponEntity } from './weapon.entity';

@Entity('weapons_stolen_reports')
export class WeaponStolenReportEntity {
    @PrimaryGeneratedColumn() id: number;
    @Column({ type: 'int' }) weapon_id: number;
    @Column({ type: 'datetime' }) date: Date;
    @Column({ type: 'varchar', length: 80 }) stolen_location: string;
    @Column({ type: 'tinytext' }) officer_testimony: string;
    @Column({ type: 'varchar', length: 40 }) officer_name: string;
    @Column({ type: 'datetime', default: null, nullable: true }) recovery_date: Date | null;
    @Column({ type: 'varchar', length: 40, default: null, nullable: true }) recovery_by_officer: string | null;

    @OneToOne(() => WeaponEntity)
    @JoinColumn({
        name: 'weapon_id',
        referencedColumnName: 'id',
    })
    weapon?: WeaponEntity;
}
