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

@Entity('trucking_location_cargo')
export class TruckingLocationCargoEntity {
    @PrimaryGeneratedColumn() id: number;
    @Column() trucking_location_id: number;
    @Column() trucking_cargo_id: number;
    @Column({ type: 'tinyint', width: 1 }) import: boolean;
    @Column({ type: 'tinyint', width: 1 }) export: boolean;

    @ManyToOne(() => TruckingLocationEntity, (tle) => tle.locationCargo)
    @JoinColumn({ name: 'trucking_location_id' })
    location: TruckingLocationEntity;

    @ManyToOne(() => TruckingCargoEntity, (tce) => tce.locationCargo)
    @JoinColumn({ name: 'trucking_cargo_id' })
    cargo: TruckingCargoEntity;
}
