package com.fs.ksApi.impl;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.fs.ksApi.ksApiService;
import com.fs.ksApi.param.ActivationParam;
import org.springframework.stereotype.Service;

@Service
public class ksApiServiceImpl implements ksApiService {

    private static final String TRACK_ACTIVATE_URL = "http://ad.partner.gifshow.com/track/activate";

    @Override
    public void sendActivationRequest(ActivationParam activationParam) {
        HttpRequest httpRequest = HttpRequest.get(TRACK_ACTIVATE_URL)
                .form("callback", activationParam.getCallback())
                .form("event_type", activationParam.getEventType())
                .form("event_time", activationParam.getEventTime())
                .form("purchase_amount", activationParam.getPurchaseAmount() != null ? activationParam.getPurchaseAmount().toString() : null)
                .form("user_tags_age", activationParam.getUserTagsAge() != null ? activationParam.getUserTagsAge().toString() : null)
                .form("ext_pred_ltv", activationParam.getExtPredLtv() != null ? activationParam.getExtPredLtv().toString() : null)
                .form("ext_pred_pay_ratio", activationParam.getExtPredPayRatio() != null ? activationParam.getExtPredPayRatio().toString() : null)
                .form("pay_level", activationParam.getPayLevel())
                .form("novel_chapter_num", activationParam.getNovelChapterNum() != null ? activationParam.getNovelChapterNum().toString() : null);

        HttpResponse response = httpRequest.execute();

    }
}
