package com.lanyuanxiaoyao.server.entity;

import com.lanyuanxiaoyao.server.configuration.Constants;
import com.lanyuanxiaoyao.server.configuration.database.SnowflakeId;
import com.yahoo.elide.annotation.Include;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import java.util.Set;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 组织
 *
 * @author lanyuanxiaoyao
 * @version 20250327
 */
@Getter
@Setter
@ToString
@Entity
@Table(name = Constants.DATABASE_TABLE_PREFIX + "organization")
@Include
public class Organization {
  @Id
  @SnowflakeId.Generator
  private Long organizationId;
  private String organizationName;

  @OneToMany(fetch = FetchType.LAZY, mappedBy = "organization")
  @ToString.Exclude
  private Set<User> users;

  @OneToMany(fetch = FetchType.LAZY, mappedBy = "organization")
  @ToString.Exclude
  private Set<Department> departments;
}
