package com.zt.plat.module.base.controller.admin.base.vo;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
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;

@Schema(description = "管理后台 - 物料信息 Response VO")
@Data
@ExcelIgnoreUnannotated
public class MaterialInfomationRespVO {

    @JsonIgnore
    @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "3326")
    @ExcelProperty("主键ID")
    private Long id;

    @JsonIgnore
    @Schema(description = "物料编码", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("物料编码")
    private String code;

    @JsonIgnore
    @Schema(description = "物料名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
    @ExcelProperty("物料名称")
    private String name;

    @JsonIgnore
    @Schema(description = "分类ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("分类ID")
    private Long classesId;

    @JsonIgnore
    @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("备注")
    private String remark;

    @JsonIgnore
    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

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

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

}