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;

/**
 * 지니TV Adapter
 * 지니TV 광고 등록 API 호출
 *
 * @author System Architect
 * @since 2025-10-23
 */
@Slf4j
@Component
public class GiniTvAdapter extends AbstractChannelAdapter {

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

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

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

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

        return ChannelDistributionResult.builder()
                .channel(ChannelType.GINITV)
                .success(true)
                .distributionId(distributionId)
                .estimatedReach(10000) // TV 광고 노출 수
                .build();
    }
}
