package com.pj.api.client.admin;

import com.pj.api.FeignInterceptor;
import com.pj.api.consts.FeignConsts;
import com.pj.api.dto.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 系统配置 服务
 *
 * @author kong
 */
@FeignClient(
        name = FeignConsts.SP_ADMIN,                // 服务名称
        configuration = FeignInterceptor.class,        // 请求拦截器
        fallbackFactory = AdminInterfaceFallback.class    // 服务降级
)
public interface AdminInterface {


    /**
     * 收购商认证 步骤2
     */
    @RequestMapping("/AppUser/rpc/saveAppUserInfo")
    public Boolean saveAppUserInfo(@RequestBody AppUserDto appUser);

    /**
     * 收购商认证 步骤1
     */
    @RequestMapping("app/AppUser/rpc/getByPhoneAndUserType")
    public AppUserDto getByPhoneAndUserType(@RequestParam("phone") String phone,@RequestParam("userType")Integer userType);

    /**
     * 启/停边民的app账号登陆限制
     */
    @RequestMapping("/AppUser/rpc/isLock")
    int isLock(@RequestParam("id") String id,
               @RequestParam("type") Integer type,
               @RequestParam("status") Integer status);

    /**
     * 查单个app用户 - 根据id
     */
    @RequestMapping("/AppUser/rpc/getById")
    AppUserDto getAppUserById(@RequestParam("id") Long id);


    @RequestMapping("/TbMessage/rpc/save")
    public void messageSave(@RequestBody MessageDto dto);

    @RequestMapping("/AppUser/rpc/audit")
    public boolean audit(@RequestBody EnterpriseAuditDto dto);

    /**
     * 根据城市名称查找地区数据
     *
     * @param cityName
     * @return
     */
    @RequestMapping("/TbDistrict/rpc/findInfoByCityName")
    DistrictInfoDTO findInfoByCityName(String cityName);

    /**
     * 根据IDs查找地区
     *
     * @param ids
     * @return
     */
    @RequestMapping(value = "TbDistrict/rpc/getByIds")
    List<DistrictDTO> getDistrictList(@RequestParam("ids") String ids);

    /**
     * 同步航通边民信息时,自动给边民注册app账号
     */
    @RequestMapping("/AppUser/rpc/generatePeopleAccount")
    public boolean generatePeopleAccount(@RequestBody PeopleDto peopleDto) throws Exception;

    /**
     * 同步航通边民信息时,自动给外籍商户注册app账号
     */
    @RequestMapping("/AppUser/rpc/generateEnterpriseAccount")
    public int generateEnterpriseAccount(@RequestBody EnterpriseDto enterpriseDto) throws Exception ;

}
