package cn.com.ctop.kuaishou.modules.batch.service;


import cn.com.ctop.common.module.entity.CtopOauthToken;
import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResult;
import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
import cn.com.ctop.kuaishou.modules.report.entity.*;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author yumeng
 * 2019年11月12日11:08:52
 */
public interface IKuaishouInterfaceService {
    KuaishouResult<KuaishouReportHourlyAccount> getAccountHourlyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum);

    KuaishouResult<KuaishouReportDailyAccount> getAccountDailyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum);

    KuaishouResult<KuaishouReportDailyCampaign> getCampaignDailyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum);

    KuaishouResult<KuaishouReportHourlyCampaign> getCampaignHourlyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum);

    KuaishouResult<KuaishouReportDailyGroup> getGroupDailyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum);

    KuaishouResult<KuaishouReportHourlyGroup> getGroupHourlyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum);

    KuaishouResult<KuaishouReportDailyCreative> getCreativeDailyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum);

    KuaishouResult<KuaishouReportHourlyCreative> getCreativeHourlyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum);

    void loadAllKuaishouData(List<CtopOauthToken> tokens);

    void loadKuaishouDataSingle(CtopOauthToken token);

    /**
     * 创建广告计划
     *
     * @param accessToken
     * @param advertiserId
     * @param requestJson
     * @return
     */
    Map<String, Object> campaignCreate(String accessToken, Long advertiserId, JSONObject requestJson);


    /**
     * 创建广告组
     *
     * @param accessToken
     * @param advertiserId
     * @param requestJson
     * @return
     */
    Map<String, Object> adUnitCreate(String accessToken, Long advertiserId, JSONObject requestJson);


    /**
     * 获取广告计划信息  全量
     *
     * @param accessToken
     * @param advertiserId
     */
    void getCampaignList(String accessToken, Long advertiserId, Date startDate, Date endDate, Integer page);


    /**
     * 获取广告计划信息  单条
     *
     * @param accessToken
     * @param advertiserId
     */
    void getCampaign(String accessToken, Long advertiserId, Long campaignId);

    /**
     * 获取广告组信息 全量
     *
     * @param accessToken
     * @param advertiserId
     * @param page
     */
    void getGroupList(String accessToken, Long advertiserId, Date startDate, Date endDate, Integer page);

    /**
     * 获取广告组信息 单条
     *
     * @param accessToken
     * @param advertiserId
     * @param
     */
    void getGroup(String accessToken, Long advertiserId, Long unitId);


    void getCreativeList(CtopOauthToken token, Date startDate, Date endDate);

    void getVideoInfo(String accessToken, Long advertiserId, String photoId);

    /**
     * 获取创意信息
     *
     * @param accessToken
     * @param advertiserId
     */
    void getCreativeList(String accessToken, Long advertiserId, Date startDate, Date endDate, Integer page);

    /**
     * 获取token
     *
     * @param authCode
     * @return
     */
    KuaishouResultToken getAccessToken(String authCode);


    /**
     * 获取可选的深度转化类型
     *
     * @param advertiserId
     * @return
     */
    Map<String, Object> getDeepConversionInfos(Long advertiserId, String accessToken);

    JSONObject getDeepConversionInfosV2(Long advertiserId, String accessToken);


    /**
     * 创建广告创意
     *
     * @param accessToken
     * @param advertiserId
     * @param requestJson
     */
    Map<String, Object> creativeCreate(String accessToken, Long advertiserId, JSONObject requestJson);

    /**
     * 文件上传
     *
     * @param advertiserId
     * @param accessToken
     * @return
     */
    Map<String, Object> videoUpload(Long advertiserId, String accessToken, String videoUrl);

    /**
     * 获取视频
     *
     * @param advertiserId
     * @param accessToken
     * @param photoId
     */
    void videoGet(Long advertiserId, String accessToken, String photoId, String signature);

    /**
     * 获取图片信息
     *
     * @param advertiserId
     * @param accessToken
     * @param imageToken
     */
    void imageGet(Long advertiserId, String accessToken, String imageToken);

    /**
     * 获取 地域列表
     *
     * @param accessToken
     */
    void areaList(String accessToken);


    /**
     * 图片上传
     *
     * @param advertiserId
     * @param accessToken
     * @return
     */
    Map<String, Object> imageUpload(Long advertiserId, String accessToken, String filePath, Integer type);


    /**
     * 创建应用
     *
     * @param advertiserId
     * @param accessToken
     * @return
     */
    Map<String, Object> appCreate(Long advertiserId, String accessToken, JSONObject requestJson);


    /**
     * 获取应用列表
     *
     * @param advertiserId
     * @param accessToken
     */
    void getAppList(Long advertiserId, String accessToken);

    /**
     * 文件上传 发送请求
     *
     * @param url
     * @param paramMap
     * @param headerMap
     * @param filePath
     */
    String exceptInfoForRestTemplate(String url, Map<String, Object> paramMap, Map<String, String> headerMap, String filePath);


    /**
     * 修改应用
     *
     * @param advertiserId
     * @param accessToken
     * @param requestJson
     * @param multipartFile
     * @param request
     */
    void appUpdate(Long advertiserId, String accessToken, JSONObject requestJson, MultipartFile multipartFile, HttpServletRequest request);

    /**
     * 创建 url应用
     *
     * @param accountId
     * @param accessToken
     * @param apkJson
     * @return
     */
    Map<String, Object> urlAppCreate(Long accountId, String accessToken, JSONObject apkJson);

    /**
     * 快手 广告主信息
     *
     * @param accountId
     * @param accessToken
     * @return
     */
    Map<String, Object> advertiserInfo(Long accountId, String accessToken);

    void getVideoList(CtopOauthToken token, Date startDate, Date endDate);

    void getVideoList(String token, Long advertiserId, Date startDate, Date endDate, int page);

    void getAdvertiserReportDaily(CtopOauthToken token, Date startDate, Date endDate);

    void getAdvertiserCampaignReportDaily(CtopOauthToken token, Date startDate, Date endDate);

    void getAdvertiserGroupReportDaily(CtopOauthToken token, Date startDate, Date endDate);

    void getAdvertiserCreativeReportDaily(CtopOauthToken token, Date startDate, Date endDate);

    void getAdvertiserReportHourly(CtopOauthToken token, Date startDate, Date endDate);

    void getAdvertiserCampaignReportHourly(CtopOauthToken token, Date startDate, Date endDate);

    void getAdvertiserGroupReportHourly(CtopOauthToken token, Date startDate, Date endDate);

    void getAdvertiserCreativeReportHourly(CtopOauthToken token, Date startDate, Date endDate);

    void getCampaignList(CtopOauthToken token, Date startDate, Date endDate);

    void getGroupList(CtopOauthToken token, Date startDate, Date endDate);

    void loadData() throws InterruptedException;

    void updateCreativeReportHourlyStatistic(CtopOauthToken token, Date getDate);

    void deleteHourlyReport(Date deleteDate);

    /**
     * 获取快手图片列表
     *
     * @param token
     * @param startDate
     * @param endDate
     */
    void getImageList(CtopOauthToken token, Date startDate, Date endDate);

    /**
     * 获取快手图片列表--测试使用
     *
     * @param token
     * @param accountId
     * @param startDate
     * @param endDate
     * @param page
     */
    void getImageList(String token, Long accountId, Date startDate, Date endDate, int page);

    /**
     * 获取账户余额
     *
     * @param oauthToken
     * @return
     */
    JSONObject fundGet(CtopOauthToken oauthToken);


    /**
     * 获取账户流水数据
     *
     * @param token
     */
    void getDailyFlows(CtopOauthToken token);


    /**
     * 获取人群包接口
     *
     * @param accountId
     * @param accessToken
     * @return
     */
    JSONArray getPopulationList(Long accountId, String accessToken);


    /**
     * 获取定向标签
     *
     * @param accountId
     * @param accessToken
     */
    void getTargetingTags(Long accountId, String accessToken);


    /**
     * 获取可选的应用定向
     *
     * @param accountId
     * @param accessToken
     * @param appName
     * @return
     */
    JSONArray getAppSearch(Long accountId, String accessToken, String appName);

}
