package com.sptg.estate.api.feigns;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.estate.api.dto.MemberDto;
import com.sptg.estate.api.entity.Member;
import com.sptg.estate.api.feigns.fallback.MemberFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * title: MemberFeign
 * package: com.sptg.estate.api.feigns
 * description::会员-服务接口
 *
 *               
 *                
 */
@FeignClient(value= "smart-house-estate",fallbackFactory= MemberFeignFallbackFactory.class)
public interface MemberFeign {

    /**
     * 功能描述:通过openid获取会员
     * @param memberDto
     * @return ResultBean<Member>
     *                
     *                      
     */
    @PostMapping(value = "/member/getMemberByOpenid")
    ResultBean<Member> getMemberByOpenid(@RequestBody MemberDto memberDto);

    @PostMapping(value = "/member/getMemberById")
    ResultBean<Member> getMemberById(@RequestBody MemberDto memberDto);
    /**
     * 功能描述: 会员注册
     * @param member
     * @return
     *               
     *                      
     */
    @PostMapping(value = "/member/memberRegister")
    ResultBean<Boolean> memberRegister(@RequestBody Member member);
    /**
     * 功能描述: 检测同一机构下面一个手机号码只能注册一个会员
     * @param  member
     * @return
     *               
     *                      
     */
    @PostMapping(value = "/member/checkMemberTel")
    ResultBean<Boolean> checkMemberTel(@RequestBody Member member);

    /**
     * 功能描述:小程序端openid关联到指定会员--orgid和phone和name
     * @param  member
     * @return
     *                      
     */
    @PostMapping(value = "/member/updateMemberOpenId")
    ResultBean<Boolean> updateMemberOpenId(@RequestBody Member member);

    /**
     * 功能描述:根据位置查询会员数量
     * @param memberDto
     * {
     *    orgPosition : 位置信息
     * }
     * @return ResultBean<Map<String,Integer>>
     *             
     *                      
     */
    @PostMapping(value = "/member/getMemberAccount")
    ResultBean<Map<String,Integer>> getMemberAccount(@RequestBody MemberDto memberDto);
    /**
     * 功能描述:根据memberId查询会员
     * @param memberId
     * @return Member
     *               
     *                      
     */
    @PostMapping(value = "/member/getMemberByMemberId")
    Member getMemberByMemberId(Long memberId);

    /**
     * 功能描述:根据类型获取会员的数量
     * @param memberDto
     * @return ResultBean<Map<String,Object>>
     *             
     *                      
     */
    @PostMapping(value = "/member/getMemberTypeCount")
    ResultBean<Map<String,Object>> getMemberTypeCount(@RequestBody MemberDto memberDto);

    /**
     * 功能描述:重置密码
     * @param member
     * @return ResultBean<Boolean>
     *               
     *                      
     */
    @PostMapping(value = "/member/updateMemberPassword")
    ResultBean<Boolean> updateMemberPassword(@RequestBody Member member);

    /**
     * 功能描述： 更换绑定手机
     * @param member
     * @return
     */
    @PostMapping(value = "/member/changeTel")
    ResultBean<Boolean> changeTel(@RequestBody Member member);

    /**
     * 功能描述:根据电话查询当前机构下的会员
     * @param member
     * @return Member
     *               
     *                      
     */
    @PostMapping(value = "/member/findMemberByTel")
    Member findMemberByTel(@RequestBody Member member);

    /**
     * 功能描述:分页查询会员列表
     * @param memberDto
     * @return Member
     *               
     *                      
     */
    @PostMapping(value = "/member/showMemberList")
    ResultBean<Page<Member>> showMemberList(@RequestBody MemberDto memberDto);
    /**
     * 功能描述: 会员注册--特殊
     * @param member
     * @return
     *               
     *                      
     */
    @PostMapping(value = "/member/memberRegisterNew")
    ResultBean<Member> memberRegisterNew(@RequestBody Member member);

    /**
     * 根据old查询
     * @param oldId 原数据Id
     * @return Member
     */
    @GetMapping(value = "/member/getByOldId/{oldId}")
    Member getByOldId(@PathVariable(value = "oldId")String oldId);

    /**
     * 更新用户信息
     * @param member 更新信息
     * @return boolean
     */
    @PostMapping(value = "/member/updateMember")
    ResultBean<Boolean> updateMember(@RequestBody Member member);

    /**
     * 更新用户信息
     * @param memberDto 更新信息
     * @return boolean
     */
    @PostMapping(value = "/member/activation")
    ResultBean<Boolean> activation(@RequestBody MemberDto memberDto);

    /**
     * 根据条件查询member
     * @param member
     * @return
     */
    @PostMapping(value = "/member/selectMember")
    Member getMember(@RequestBody Member member);

    @PostMapping(value = "/member/delete")
    ResultBean<Boolean> delete(@RequestParam(value = "memberId") Long memberId);

}
