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

@Entity('vehicle_stolen_reports')
export class VehicleStolenReportEntity {
    @PrimaryGeneratedColumn() id: number;
    @Column({ type: 'int' }) vehicle_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(() => VehicleEntity)
    @JoinColumn({
        name: 'vehicle_id',
        referencedColumnName: 'id',
    })
    vehicle?: VehicleEntity;
}
