package com.bytesw.bytebot.model;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.*;

@Entity
@Table(name = "AVB_LEG")
@NamedQuery(name = "Leg.findByPK", query = "Select u from Leg u where u.id = ?1")
@Getter
@Setter
@EqualsAndHashCode
@ToString(exclude = "id")
public class Leg {
    @Id
    @Column(name = "leg_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ManyToOne
    private Flight flight;

    @OneToOne
    private Airport origin;

    @OneToOne
    private Airport destination;

    @Column(name = "leg_departure_date", nullable = false)
    private String departureDate;

    @Column(name = "leg_arrival_date", nullable = false)
    private String arrivalDate;

    @Column(name = "leg_departure_time", nullable = false)
    private String departureTime;

    @Column(name = "leg_arrival_time", nullable = false)
    private String arrivalTime;
}
