package com.nebula.erp.sales.model;

import com.fasterxml.jackson.annotation.JsonBackReference;
import jakarta.persistence.*;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;

@Data
@Entity
@Table(name = "prescription_item")
@Getter
@Setter
public class PrescriptionItem {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ManyToOne
    @JoinColumn(name = "prescription_id", nullable = false)
    @JsonBackReference
    private Prescriptions prescription;

    private String type;

    private String product_id;

    private String product_name;

    private Double product_price;
    private Long room_id;

    private String location_id;

    private String room_number;

    private Double total_price;

     private Long tax_id;

    private Double tax_rate;

    @Column(nullable = false)
    private Integer quantity;

    @Column(name = "is_sale")
    private Boolean is_sale = false; // Set default value as false

    @Column(name = "batch_code")
    private String batch_code;

    private String created_by;

    private String tenant;

    private LocalDateTime created_at = LocalDateTime.now();
    private LocalDateTime updated_at = LocalDateTime.now();
    private LocalDateTime deleted_at = null;

}