package shop.alien.store.util.ai;

import com.alibaba.fastjson2.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 视频审核占位：视频由前端直连 AI，服务端不调用视频审核接口。
 * <p>保留 {@link #auditVideos} 供业务异步流程调用，恒为通过，避免历史代码空指针。</p>
 */
@Slf4j
@Component
public class AiVideoModerationUtil {

    public static class VideoAuditResult {
        private final boolean passed;
        private final String failureReason;
        private final String taskId;
        private final JSONObject rawResult;

        public VideoAuditResult(boolean passed, String failureReason) {
            this(passed, failureReason, null, null);
        }

        public VideoAuditResult(boolean passed, String failureReason, String taskId, JSONObject rawResult) {
            this.passed = passed;
            this.failureReason = failureReason;
            this.taskId = taskId;
            this.rawResult = rawResult;
        }

        public boolean isPassed() {
            return passed;
        }

        public String getFailureReason() {
            return failureReason;
        }

        public String getTaskId() {
            return taskId;
        }

        public JSONObject getRawResult() {
            return rawResult;
        }
    }

    /**
     * 不进行服务端视频审核；前端已审则此处仅打日志并返回通过。
     */
    public VideoAuditResult auditVideos(List<String> videoUrls) {
        if (videoUrls == null || videoUrls.isEmpty()) {
            return new VideoAuditResult(true, null);
        }
        log.info("跳过服务端视频审核（前端已处理），条数={}", videoUrls.size());
        return new VideoAuditResult(true, null);
    }
}
