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.*;

import java.util.List;

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


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

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

    /**
     * 启/停边民的app账号登陆限制
     */
    @PostMapping("/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);


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

    @PostMapping("/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账号
     * @param createDTO
     */
    @PostMapping("AppUser/rpc/createAppAccount")
    public boolean createAccount(@RequestBody AppUserCreateDTO createDTO);


    /**
     * 创建合作社代表后台管理账号
     * @param dto
     */
    @PostMapping("admin/rpc/createAdmin")
    public boolean createAdmin(@RequestBody AdminCreateDto dto);

    /**
     * 根据fkId查app用户
     */
    @PostMapping("AppUser/rpc/getByFkId")
    public AppUserDto getByFkId(@RequestParam("fkId") Long fkId);


    @PostMapping("AppUser/rpc/changeBindShopStatus")
    public void changeBindShopStatus(@RequestBody BindShopDTO bindShopDTO);

    @RequestMapping("AppUser/rpc/findUserByPhone")
    AppUserDto findUserByPhone(@RequestParam("phone") String phone);

    @PostMapping("AppUser/rpc/updateAccount")
    int updateAccount(UpdateAccountDTO updateAccountDTO);

    @PostMapping("AppUser/rpc/bindFkId")
    boolean bindFkId(@RequestParam("appUserId") Long appUserId,@RequestParam("fkId")  Long fkId);
}
