import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { TruckingLocationEntity } from './trucking-location.entity';

@Entity('trucking_location_flatbed_bays')
export class TruckingLocationFlatbedBayEntity {
    @PrimaryGeneratedColumn() id: number;
    @Column() trucking_location_id: number;
    @Column({ type: 'float' }) x: number;
    @Column({ type: 'float' }) y: number;
    @Column({ type: 'float' }) z: number;

    @ManyToOne(() => TruckingLocationEntity, (location) => location.loadingBays, {
        eager: true,
    })
    @JoinColumn({ name: 'trucking_location_id' })
    truckingLocation: TruckingLocationEntity;

    get position(): Vector3 {
        return new mp.Vector3(this.x, this.y, this.z);
    }
}
