import { Place } from 'src/place/entities/place.entity';
import { Route } from 'src/route/entities/route.entity';
import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';

@Entity()
export class TravelPlace {
  @PrimaryGeneratedColumn()
  travelPlaceId: number;

  @JoinColumn({ name: 'route' })
  @ManyToOne(() => Route, (route) => route.idRoute)
  route: Route;

  @JoinColumn({ name: 'place' })
  @ManyToOne(() => Place, (place) => place.idPlace, { eager: true })
  place: Place;

  @Column({ nullable: false })
  startDate: Date;
  @Column({ nullable: false })
  endDate: Date;

  @Column({ nullable: false })
  done: boolean;
}
