package com.talentcard.server.response; import java.time.LocalDateTime; import com.talentcard.server.entity.DependentCardApply; import io.swagger.v3.oas.annotations.media.Schema; @Schema(name = "DependentCardApplyAdminResponse", description = "\u7ba1\u7406\u540e\u53f0\u5bb6\u5c5e\u9644\u5c5e\u5361\u7533\u8bf7\u4fe1\u606f") public record DependentCardApplyAdminResponse( Long id, String applyNo, Long talentId, Long talentCardId, String talentName, String talentMobile, String talentCardNo, String cardLevel, String dependentName, String dependentMobile, String dependentIdCardNo, String relation, String proofFiles, Integer status, String statusText, LocalDateTime applyTime, Long auditBy, LocalDateTime auditTime, String auditRemark ) { public static DependentCardApplyAdminResponse from(DependentCardApply apply) { return new DependentCardApplyAdminResponse( apply.getId(), apply.getApplyNo(), apply.getTalentId(), apply.getTalentCardId(), apply.getTalentName(), apply.getTalentMobile(), apply.getTalentCardNo(), apply.getCardLevel(), apply.getDependentName(), apply.getDependentMobile(), apply.getDependentIdCardNo(), apply.getRelation(), apply.getProofFiles(), apply.getStatus(), statusText(apply.getStatus()), apply.getApplyTime(), apply.getAuditBy(), apply.getAuditTime(), apply.getAuditRemark() ); } private static String statusText(Integer status) { if (status == null) return "\u672a\u77e5"; return switch (status) { case DependentCardApply.STATUS_PENDING_REVIEW -> "\u5f85\u5ba1\u6838"; case DependentCardApply.STATUS_APPROVED -> "\u5df2\u901a\u8fc7"; case DependentCardApply.STATUS_REJECTED -> "\u5df2\u9a73\u56de"; case DependentCardApply.STATUS_CANCELLED -> "\u5df2\u89e3\u7ed1"; default -> "\u672a\u77e5"; }; } }