package com.yihu.jw.fegin.base.login;

import com.yihu.jw.fegin.fallbackfactory.base.base.LoginFeignFallbackFactory;
import com.yihu.jw.common.CommonContants;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.rm.base.BaseLoginRequestMapping;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Created by 刘文彬 on 2018/4/20.
 */
@FeignClient(
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  = LoginFeignFallbackFactory.class
)
@RequestMapping(value = BaseLoginRequestMapping.api_common)
public interface LoginFeign {

    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_checkoutInfo, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop checkoutInfo(@RequestParam(value = "ssc", required = true) String ssc, @RequestParam(value = "idcard", required = true) String idcard);

    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_accountSub, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    MixEnvelop register(
            @RequestParam(value = "mobilePhone", required = true) String mobilePhone,
            @RequestParam(value = "saasId", required = true) String saasId,
            @RequestParam(value = "type", required = true) int type,
            @RequestParam(value = "captcha", required = true) String captcha,
            @RequestParam(value = "name", required = true) String name,
            @RequestParam(value = "password", required = true) String password,
            @RequestParam(value = "idcard", required = true) String idcard,
            @RequestParam(value = "ssc", required = true) String ssc);


    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_login, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    MixEnvelop login(@RequestParam(value = "mobilePhone", required = false) String mobilePhone,
                     @RequestParam(value = "password", required = false) String password,
                     @RequestParam(value = "saasId", required = true) String saasId,
                     @RequestParam(value = "captcha", required = false) String captcha);
}