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

import com.zhongshu.card.client.utils.ITree;
import com.zhongshu.card.client.type.DataState;
import com.zhongshu.card.server.core.domain.base.SuperMain;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.checkerframework.common.aliasing.qual.NonLeaked;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * 区域管理 （树形结构）
 *
 * @author TRX
 * @date 2024/6/12
 */
@Data
@Document
@AllArgsConstructor
@NoArgsConstructor
@NonLeaked
public class Area extends SuperMain {
    @Schema(description = "区域名称")
    private String name;

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

    @Schema(description = "区域状态")
    private DataState state = DataState.Enable;

    @Schema(description = "上级ID")
    @Indexed
    private String parentId = ITree.ROOT_ID;

    @Schema(description = "区域类型")
    private DictInfo dictInfo;

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