package ink.wgink.login.app.service.appversion;

import ink.wgink.exceptions.FileException;
import ink.wgink.exceptions.SearchException;
import ink.wgink.exceptions.UpdateException;
import ink.wgink.login.app.pojo.dtos.appversion.AppVersionDTO;
import ink.wgink.login.app.pojo.pos.appversion.AppVersionPO;
import ink.wgink.login.app.pojo.vos.appversion.AppVersionSaveVO;
import ink.wgink.login.app.pojo.vos.appversion.AppVersionVO;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResultData;
import ink.wgink.pojo.result.SuccessResultList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: IAppDeviceService
 * @Description: app设备
 * @Author: wanggeng
 * @Date: 2021/4/7 4:19 下午
 * @Version: 1.0
 */
public interface IAppVersionService {

    /**
     * 新增app版本
     *
     * @param appVersionSaveVO
     * @return
     */
    void save(AppVersionSaveVO appVersionSaveVO);

    /**
     * 删除
     *
     * @param ids
     */
    void remove(List<String> ids);

    /**
     * 修改
     *
     * @param appVersionId
     * @param appVersionVO
     */
    void update(String appVersionId, AppVersionVO appVersionVO);

    /**
     * 更新APP接口锁定状态
     *
     * @param appVersionId
     * @param appApiLock
     */
    void updateApiLock(String appVersionId, Integer appApiLock);

    /**
     * 更新APP为发布状态
     *
     * @param appVersionId
     * @param isRelease
     */
    void updateRelease(String appVersionId, int isRelease);

    /**
     * APP接口是否锁定，如果锁定，必须升级APP
     *
     * @param appVersionId
     * @param appVersion
     * @return
     */
    boolean canApiLock(String appVersionId, String appVersion);

    /**
     * 详情
     *
     * @param params
     * @return
     */
    AppVersionDTO get(Map<String, Object> params);

    /**
     * 详情
     *
     * @param appVersionId
     * @return
     */
    AppVersionDTO get(String appVersionId);

    /**
     * 详情
     *
     * @param params
     * @return
     */
    AppVersionPO getPO(Map<String, Object> params);

    /**
     * 详情
     *
     * @param appVersionId
     * @return
     */
    AppVersionPO getPO(String appVersionId);

    /**
     * 详情
     *
     * @param appVersionId
     * @param isRelease
     * @return
     */
    AppVersionPO getPO(String appVersionId, int isRelease);

    /**
     * 列表
     *
     * @param params
     * @return
     */
    List<AppVersionDTO> list(Map<String, Object> params);

    /**
     * 列表（分页）
     *
     * @param page
     * @return
     */
    SuccessResultList<List<AppVersionDTO>> listPage(ListPage page);

    /**
     * 获取app二维码
     *
     * @param appVersionId
     * @param response
     */
    void downloadQrCode(String appVersionId, HttpServletResponse response) throws IOException;

    /**
     * 获取APP当前版本号
     *
     * @param appVersionId
     * @return
     * @throws SearchException
     */
    Integer getNumber(String appVersionId) throws SearchException;

    /**
     * 下载APP
     *
     * @param appVersionId
     * @param request
     * @param response
     */
    void download(String appVersionId, HttpServletRequest request, HttpServletResponse response);
}
