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;

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

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

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

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

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

        return ChannelDistributionResult.builder()
                .channel(ChannelType.INSTAGRAM)
                .success(true)
                .distributionId(distributionId)
                .estimatedReach(3000) // 팔로워 수 기반 예상 노출
                .build();
    }
}
