package com.kt.distribution.adapter;

import com.kt.distribution.dto.ChannelDistributionResult;
import com.kt.distribution.dto.ChannelType;
import com.kt.distribution.dto.DistributionRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.UUID;

/**
 * Naver Blog Adapter
 * Naver Blog 포스팅 API 호출
 *
 * @author System Architect
 * @since 2025-10-23
 */
@Slf4j
@Component
public class NaverAdapter extends AbstractChannelAdapter {

    @Value("${channel.apis.naver.url}")
    private String apiUrl;

    @Override
    public ChannelType getChannelType() {
        return ChannelType.NAVER;
    }

    @Override
    protected ChannelDistributionResult executeDistribution(DistributionRequest request) {
        log.debug("Calling Naver API: url={}, eventId={}", apiUrl, request.getEventId());

        // TODO: 실제 API 호출 (현재는 Mock)
        String distributionId = "NAVER-" + UUID.randomUUID().toString();

        return ChannelDistributionResult.builder()
                .channel(ChannelType.NAVER)
                .success(true)
                .distributionId(distributionId)
                .estimatedReach(2000) // 블로그 방문자 수 기반
                .build();
    }
}
