content: package com.example.auction.model;
  
  import com.fasterxml.jackson.annotation.JsonManagedReference;
  import jakarta.persistence.*;
  import java.math.BigDecimal;
  import java.time.LocalDateTime;
  import java.util.ArrayList;
  import java.util.List;
  import java.util.UUID;
  
  @Entity
  @Table(name = "auctions")
  public class Auction {
      @Id
      private String id;
      
      @Column(nullable = false, length = 200)
      private String title;
      
      @Column(nullable = false, length = 1000)
      private String description;
      
      @Column(name = "starting_price", nullable = false, precision = 10, scale = 2)
      private BigDecimal startingPrice;
      
      @Column(name = "current_price", nullable = false, precision = 10, scale = 2)
      private BigDecimal currentPrice;
      
      @Column(name = "minimum_increment", nullable = false, precision = 10, scale = 2)
      private BigDecimal minimumIncrement;
      
      @Column(name = "highest_bidder_id")
      private String highestBidderId;
      
      @Column(name = "highest_bidder_name")
      private String highestBidderName;
      
      @Enumerated(EnumType.STRING)
      @Column(nullable = false)
      private AuctionStatus status = AuctionStatus.OPEN;
      
      @Column(name = "created_at", nullable = false)
      private LocalDateTime createdAt;
      
      @Column(name = "ends_at", nullable = false)
      private LocalDateTime endsAt;
      
      @OneToMany(mappedBy = "auction", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
      @JsonManagedReference
      private List<Bid> bids = new ArrayList<>();
      
      @PrePersist
      public void prePersist() {
          if (this.id == null) {
              this.id = UUID.randomUUID().toString();
          }
          if (this.createdAt == null) {
              this.createdAt = LocalDateTime.now();
          }
      }
      
      // Getters and Setters
      public String getId() { return id; }
      public void setId(String id) { this.id = id; }
      
      public String getTitle() { return title; }
      public void setTitle(String title) { this.title = title; }
      
      public String getDescription() { return description; }
      public void setDescription(String description) { this.description = description; }
      
      public BigDecimal getStartingPrice() { return startingPrice; }
      public void setStartingPrice(BigDecimal startingPrice) { this.startingPrice = startingPrice; }
      
      public BigDecimal getCurrentPrice() { return currentPrice; }
      public void setCurrentPrice(BigDecimal currentPrice) { this.currentPrice = currentPrice; }
      
      public BigDecimal getMinimumIncrement() { return minimumIncrement; }
      public void setMinimumIncrement(BigDecimal minimumIncrement) { this.minimumIncrement = minimumIncrement; }
      
      public String getHighestBidderId() { return highestBidderId; }
      public void setHighestBidderId(String highestBidderId) { this.highestBidderId = highestBidderId; }
      
      public String getHighestBidderName() { return highestBidderName; }
      public void setHighestBidderName(String highestBidderName) { this.highestBidderName = highestBidderName; }
      
      public AuctionStatus getStatus() { return status; }
      public void setStatus(AuctionStatus status) { this.status = status; }
      
      public LocalDateTime getCreatedAt() { return createdAt; }
      public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
      
      public LocalDateTime getEndsAt() { return endsAt; }
      public void setEndsAt(LocalDateTime endsAt) { this.endsAt = endsAt; }
      
      public List<Bid> getBids() { return bids; }
      public void setBids(List<Bid> bids) { this.bids = bids; }
  }