package com.zt.plat.module.base.api.departmentmaterial.dto;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * 组织架构物料 Response DTO
 */
@Data
public class DepartmentMaterialRespDTO {

    @Schema(description = "主键ID", example = "5674")
    private Long id;

    @Schema(description = "物料信息ID", example = "3923")
    private Long infomationId;

    @Schema(description = "物料分类ID", example = "30114")
    private Long classesId;

    @Schema(description = "字典数据值-物料类型")
    private String dictionaryDataValue;

    @Schema(description = "备注")
    private String remark;

    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    @Schema(description = "部门ID")
    private Long deptId;

    @Schema(description = "部门名称")
    private String deptName;

    @Schema(description = "物料编码")
    private String materialNumber;

    @Schema(description = "物料名称")
    private String materialName;

    @Schema(description = "物料大类名称")
    private String categoryLargeName;

    @Schema(description = "物料中类名称")
    private String categoryMediumName;

    @Schema(description = "物料小类名称")
    private String categorySmallName;

    @Schema(description = "物料分类路径")
    private String categoryPath;

    @Schema(description = "组织物料类型名称")
    private String dictionaryDataLabel;

    @Schema(description = "状态编码")
    private String status;

    @JsonIgnore
    @Schema(description = "物料基础字段 + 属性编码->原值的动态键值，基础字段优先，序列化时直接展开为顶层字段")
    private Map<String, Object> flatAttributes;

    @JsonAnyGetter
    public Map<String, Object> getFlatAttributes() {
        return flatAttributes;
    }
}
