import { Column, Entity, Index, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { CompanyEntity } from './company.entity';
import { CompanyPositionEntity } from './company-position.entity';

@Entity('company_employment_points')
export class CompanyEmploymentPointEntity {
    @PrimaryGeneratedColumn() id: number;
    @Index()
    @Column()
    company_id: number;
    @Index()
    @Column()
    company_position_id: number;
    @Column({ type: 'int', nullable: true }) blip: number | null;
    @Column({ type: 'int', nullable: true }) marker: number | null;

    @Column({ type: 'float' }) x: number;
    @Column({ type: 'float' }) y: number;
    @Column({ type: 'float' }) z: number;
    @Column() dimension: number;

    @Column({ type: 'varchar', length: 32 }) image: string;
    @Column({ type: 'text' }) description: string;

    @Column({ type: 'tinyint', default: 0 }) requires_drivers_license: boolean;
    @Column({ type: 'tinyint', default: 0 }) requires_cdl: boolean;

    @Column({ type: 'varchar', length: 64, nullable: true }) wiki_link_title: string | null;

    @ManyToOne(() => CompanyEntity, (company) => company.employmentPoints)
    @JoinColumn({ name: 'company_id' })
    company: CompanyEntity;

    @ManyToOne(() => CompanyPositionEntity)
    @JoinColumn({ name: 'company_position_id' })
    position: CompanyPositionEntity;

    blipEntity?: BlipMp;
    markerEntity?: MarkerMp;
    colShapeEntity?: ColshapeMp;
}
