package org.qinan.safetyeval.app.support;

import org.qinan.safetyeval.app.config.SafetyEvalAttachmentProperties;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

import javax.annotation.Resource;

/**
 * 备案附件 URL 解析（空值时使用默认 URL）
 */
@Component
public class QualFilingAttachmentHelper {

    @Resource
    private SafetyEvalAttachmentProperties attachmentProperties;

    public String resolveUrl(String uploadedUrl) {
        if (StringUtils.hasText(uploadedUrl)) {
            return uploadedUrl;
        }
        return attachmentProperties.getDefaultUrl();
    }
}
