package com.bytesw.bytebot.model;

import lombok.*;
import org.hibernate.envers.Audited;

import javax.persistence.*;
import java.util.List;

@Audited
@Entity
@Getter
@Setter
@ToString
@NoArgsConstructor
@Table(name = "avb_country")
@NamedQuery(name = "Country.findByPK", query = "Select u from Country u where u.id = ?1")
public class Country {

    @Id
    @Column(name = "coun_id")
    @SequenceGenerator(name = "AVB_COUNTRY_GENERATOR", sequenceName = "AVB_COUNTRY_SEQ", initialValue = 1, allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "AVB_COUNTRY_GENERATOR")
    private Long id;

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

    @OneToMany(mappedBy = "country")
    private List<Timezone> timezones;
}
