import { Column, Entity, Index, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { VehicleDealershipEntity } from './vehicle-dealership.entity';

@Entity('vehicle_dealer_bays')
export class VehicleDealerBayEntity {
    @PrimaryGeneratedColumn() id: number;
    @Index()
    @Column()
    vehicle_dealership_id: number;
    @Column('float') x: number;
    @Column('float') y: number;
    @Column('float') z: number;
    @Column('float') heading: number;
    @Column({ type: 'float', nullable: true }) cam_x: number | null;
    @Column({ type: 'float', nullable: true }) cam_y: number | null;
    @Column({ type: 'float', nullable: true }) cam_z: number | null;

    @ManyToOne(() => VehicleDealershipEntity, (dealership) => dealership.bays)
    @JoinColumn({ name: 'vehicle_dealership_id' })
    dealership?: VehicleDealershipEntity;

    occupiedByPlayerId?: number;
}
