content: package com.example.auction.model;
  
  import com.fasterxml.jackson.annotation.JsonBackReference;
  import jakarta.persistence.*;
  import java.math.BigDecimal;
  import java.time.LocalDateTime;
  import java.util.UUID;
  
  @Entity
  @Table(name = "bids")
  public class Bid {
      @Id
      private String id;
      
      @Column(name = "auction_id", nullable = false)
      private String auctionId;
      
      @ManyToOne(fetch = FetchType.LAZY)
      @JoinColumn(name = "auction_id", insertable = false, updatable = false)
      @JsonBackReference
      private Auction auction;
      
      @Column(name = "bidder_id", nullable = false)
      private String bidderId;
      
      @Column(name = "bidder_name", nullable = false)
      private String bidderName;
      
      @Column(nullable = false, precision = 10, scale = 2)
      private BigDecimal amount;
      
      @Column(nullable = false)
      private LocalDateTime timestamp;
      
      @Column(name = "is_valid", nullable = false)
      private Boolean isValid = true;
      
      @Column(name = "validation_error")
      private String validationError;
      
      @PrePersist
      public void prePersist() {
          if (this.id == null) {
              this.id = UUID.randomUUID().toString();
          }
          if (this.timestamp == null) {
              this.timestamp = LocalDateTime.now();
          }
      }
      
      // Getters and Setters
      public String getId() { return id; }
      public void setId(String id) { this.id = id; }
      
      public String getAuctionId() { return auctionId; }
      public void setAuctionId(String auctionId) { this.auctionId = auctionId; }
      
      public Auction getAuction() { return auction; }
      public void setAuction(Auction auction) { this.auction = auction; }
      
      public String getBidderId() { return bidderId; }
      public void setBidderId(String bidderId) { this.bidderId = bidderId; }
      
      public String getBidderName() { return bidderName; }
      public void setBidderName(String bidderName) { this.bidderName = bidderName; }
      
      public BigDecimal getAmount() { return amount; }
      public void setAmount(BigDecimal amount) { this.amount = amount; }
      
      public LocalDateTime getTimestamp() { return timestamp; }
      public void setTimestamp(LocalDateTime timestamp) { this.timestamp = timestamp; }
      
      public Boolean getIsValid() { return isValid; }
      public void setIsValid(Boolean isValid) { this.isValid = isValid; }
      
      public String getValidationError() { return validationError; }
      public void setValidationError(String validationError) { this.validationError = validationError; }
  }