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;

/**
 * 링고비즈 Adapter
 * 링고비즈 연결음 업데이트 API 호출
 *
 * @author System Architect
 * @since 2025-10-23
 */
@Slf4j
@Component
public class RingoBizAdapter extends AbstractChannelAdapter {

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

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

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

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

        return ChannelDistributionResult.builder()
                .channel(ChannelType.RINGOBIZ)
                .success(true)
                .distributionId(distributionId)
                .estimatedReach(1000) // 연결음 사용자 수
                .build();
    }
}
