package org.dromara.quality.constant;

import org.dromara.common.core.utils.DateUtils;
import org.dromara.quality.domain.QltQualityConstructionLog;
import org.dromara.quality.domain.QltQualityInspection;

import java.text.SimpleDateFormat;

/**
 * @author lcj
 * @date 2025/4/17 14:36
 */
public interface QltQualityConstant {

    String QUALITY_INSPECTION_CHECK_TYPE = "quality_inspection_check_type";

    String QUALITY_INSPECTION_STATUS_TYPE = "quality_inspection_status_type";

    String QUALITY_CONSTRUCTION_LOG_TEMPLATE_PATH = "template/施工日志模版.docx";

    String QUALITY_CONSTRUCTION_LOG_FILE_URL = "docs/quality/constructionLog/";

    static String getQualityConstructionLogFileUrl(QltQualityConstructionLog qualityConstructionLog) {
        String timestamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(qualityConstructionLog.getUpdateTime());
        return String.format("%s%s/%s", QUALITY_CONSTRUCTION_LOG_FILE_URL, qualityConstructionLog.getId(), timestamp);
    }

    static String getQualityConstructionLogFileName(QltQualityConstructionLog qualityConstructionLog) {
        String createDate = DateUtils.formatDate(qualityConstructionLog.getCreateTime());
        return String.format("施工日志（%s）.docx", createDate);
    }

    String QUALITY_INSPECTION_TEMPLATE_PATH = "template/整改通知单模版.docx";

    String QUALITY_INSPECTION_FILE_URL = "docs/quality/inspection/";

    static String getQualityInspectionFileUrl(QltQualityInspection qualityInspection) {
        String timestamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(qualityInspection.getUpdateTime());
        return String.format("%s%s/%s", QUALITY_INSPECTION_FILE_URL, qualityInspection.getId(), timestamp);
    }

    static String getQualityInspectionFileName(QltQualityInspection qualityInspection) {
        String createDate = DateUtils.formatDate(qualityInspection.getCreateTime());
        return String.format("整改通知单（%s）.docx", createDate);
    }

}
