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

@Entity('vehicle_dealership_models')
export class VehicleDealershipModelEntity {
    @PrimaryGeneratedColumn() id: number;
    @Index()
    @Column()
    vehicle_dealership_id: number;
    @Column({ type: 'varchar', length: 64 }) make: string;
    @Column({ type: 'varchar', length: 64 }) model: string;
    @Column({ type: 'varchar', length: 64 }) category: string;
    @Column() price: number;
    @Column({ default: 0 }) discount: number;
    @Column({ type: 'boolean', default: 0 }) readily_available: boolean;
    @Column({ type: 'json', default: '[]' }) colors: number[];
    @Column({ type: 'json', default: '[]' }) wheels: [number, number, number][];

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