package com.lanyuanxiaoyao.server.entity;

import com.yahoo.elide.annotation.Include;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.DynamicUpdate;

/**
 * @author lanyuanxiaoyao
 * @version 20250304
 */
@Getter
@Setter
@ToString
@Entity
@DynamicUpdate
@Include
public class School {
  @Id
  @GeneratedValue(strategy = GenerationType.UUID)
  private String id;
  @Column(nullable = false)
  private String name;
  @OneToMany(fetch = FetchType.LAZY, mappedBy = "school")
  @ToString.Exclude
  private List<User> users;
}
