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;

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

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

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

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

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

        return ChannelDistributionResult.builder()
                .channel(ChannelType.KAKAO)
                .success(true)
                .distributionId(distributionId)
                .estimatedReach(4000) // 채널 친구 수 기반
                .build();
    }
}
