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

import com.zhongshu.card.client.type.DataState;
import com.zhongshu.card.client.utils.ITree;
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/3
 */
@Data
@Document
@AllArgsConstructor
@NoArgsConstructor
@NonLeaked
public class Department 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;

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