package com.zhongshu.card.server.core.domain.org;

import com.github.microservice.auth.security.type.AuthType;
import com.zhongshu.card.client.type.OrganizationState;
import com.zhongshu.card.client.type.ProjectType;
import com.zhongshu.card.server.core.domain.base.SuperMain;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.List;

/**
 * 机构信息
 *
 * @author TRX
 * @date 2024/5/30
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document
@EqualsAndHashCode(callSuper = true)
@Builder
public class Organization extends SuperMain {

    @Schema(description = "机构名称")
    @Indexed
    private String name;

    @Schema(description = "编码")
    private String code;

    @Schema(description = "机构类型")
    private AuthType authType = AuthType.Enterprise;

    @Schema(description = "项目类型")
    private ProjectType dataAuthType;

    @Schema(description = "状态")
    private OrganizationState state = OrganizationState.Normal;

    @Schema(description = "管理员userId")
    private List<String> managerUserIds = new ArrayList<>();

    @Schema(description = "是否是机构类型")
    private Boolean isOrg = Boolean.FALSE;

    @Schema(description = "统一社会信用代码")
    @Indexed
    private String orgCode;

    @Schema(description = "联系人邮箱")
    @Indexed
    private String contactEmail;

    @Schema(description = "联系人-用来初始管理员")
    @Indexed
    private String contactName;

    @Schema(description = "联系人电话")
    @Indexed
    private String contactPhone;

    @Schema(description = "logo")
    private String logo;

    @Schema(description = "地址")
    private String address;

    @Schema(description = " 行政区划编码 21,2104,210403")
    private String adminDivisionItemCode;

    @Schema(description = "经度")
    private String mapLon;

    @Schema(description = "纬度")
    private String mapLat;

    public static Organization build(String id) {
        Organization entity = new Organization();
        entity.setId(id);
        return entity;
    }
}
