package org.cmh.backend.OrganizationManagement.model;

import jakarta.persistence.*;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;


@Table(name = "organizations")
@Entity
public class Organization  {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Setter
    @Getter
    private long organizationId;      // 部门ID，作为数据库表的主键
    @Setter
    @Getter
    @ManyToOne
    @JoinColumn(name = "parent_organization_id")
    private Organization parentOrganization;  // 上级部门，如果有的话
    @Setter
    @Getter
    private String organizationName;  // 部门名称
    @Setter
    @Getter
    private int displayOrder;      // 显示排序
    @Setter
    @Getter
    private String leader;           // 负责人
    @Setter
    @Getter
    private String contactPhone;   // 联系电话
    @Setter
    @Getter
    private String email;          // 邮箱
    @Setter
    @Getter
    private boolean organizationStatus;
    @Setter
    @Getter
    private String createdTime;

    public Organization() {
    }

    public Organization(Organization organization, String organizationName, int displayOrder, String leader, String contactPhone, String email, boolean organizationStatus) {
        this.parentOrganization = organization;
        this.organizationName = organizationName;
        this.displayOrder = displayOrder;
        this.leader = leader;
        this.contactPhone = contactPhone;
        this.email = email;
        this.organizationStatus = organizationStatus;
    }

    @Override
    public String toString() {
        return "Organization{" +
                "organizationId=" + organizationId +
                ", parentOrganization='" + parentOrganization + '\'' +
                ", organizationName='" + organizationName + '\'' +
                ", displayOrder=" + displayOrder +
                ", leader='" + leader + '\'' +
                ", contactPhone='" + contactPhone + '\'' +
                ", email='" + email + '\'' +
                ", organizationStatus='" + organizationStatus + '\'' +
                '}';
    }
}
