import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { PhoneEntity } from './phone.entity';

@Entity('gps_entries')
export class GpsEntryEntity {
    @PrimaryGeneratedColumn() id: number;
    @Column({ type: 'varchar', length: 128 }) name: string;
    @Column({ type: 'json' }) position: { x: number; y: number; z: number };
    @Column({ type: 'int' }) phone_id: number;

    @ManyToOne(() => PhoneEntity, (phone) => phone.gpsEntries)
    @JoinColumn({ name: 'phone_id' })
    phone: PhoneEntity;
}
