/**
 * Copyright 2008-2009. Chongqing Communications Industry Services Co.,Ltd Information Technology Branch. All rights reserved.
 * <a>http://www.crunii.com</a>
 */
package com.crunii.micro.feign.client;

import com.crunii.micro.common.dto.Result;
import com.crunii.micro.domain.dto.LoginInfoDto;
import com.crunii.micro.domain.dto.Worker;
import com.crunii.micro.domain.entity.main.TsmPropertyValue;
import com.crunii.micro.feign.client.dto.*;
import com.crunii.micro.feign.client.fallbackfactory.SysServiceFallbackFactory;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author shenhs create 2023/7/6 18:58
 */
@FeignClient(value = "service-sysmgr", fallbackFactory = SysServiceFallbackFactory.class)
public interface SysService {

    @ApiOperation(value = "登录")
    @RequestMapping(path = "/LoginController/login", method = RequestMethod.POST)
    Result<Worker> login(@RequestBody LoginDto loginDto);

    @ApiOperation(value = "短信验证码登录")
    @RequestMapping(path = "/LoginController/loginMobile", method = RequestMethod.POST)
    Result<Worker> smsCodeLogin(@RequestBody LoginPhoneDto loginDto);

    @ApiOperation(value = "短信验证码登录")
    @RequestMapping(path = "/LoginController/getPhoneCode", method = RequestMethod.POST)
    Result<String> getPhoneCode(SmsCodeSend smsCodeSend);


    @ApiOperation(value = "通过属性编码获取属性值列表")
    @RequestMapping(path = "/auth/PropertyController/getValuesByCode", method = RequestMethod.GET)
    Result<List<TsmPropertyValue>> getValuesByCode(@RequestParam("propCode") String propCode);

    @ApiOperation(value = "创建属性值")
    @RequestMapping(path = "/auth/PropertyController/createValue", method = RequestMethod.POST)
    Result<String> createValue(@RequestBody @ApiParam TsmPropertyValue valueC);

    @ApiOperation(value = "更新属性值")
    @RequestMapping(path = "/auth/PropertyController/updateValue", method = RequestMethod.POST)
    Result<String> updateValue(@RequestBody @ApiParam TsmPropertyValue valueC);

    @ApiOperation(value = "删除属性值")
    @RequestMapping(path = "/auth/PropertyController/delValue", method = RequestMethod.POST)
    Result<String> delValue(@RequestParam("propCode") String propCode, @RequestParam("valueId") Integer valueId);

    @ApiOperation(value = "创建用户")
    @RequestMapping(path = "/auth/WorkerController/createWorker", method = RequestMethod.POST)
    Result<WorkerCreateDTO> createWorker(@RequestBody @ApiParam WorkerC workerC);

    @ApiOperation(value = "创建用户")
    @RequestMapping(path = "/auth/WorkerController/createWorkerInfo", method = RequestMethod.POST)
    @ResponseBody
    public Result<Integer> createWorkerInfo(@RequestBody @ApiParam WorkerC workerC);

    @ApiOperation(value = "通过父组织Id获取子组织(数据权限过滤)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "parentOrgId", value = "父组织id", required = true)
    })
    @RequestMapping(path = "/auth/OrgController/getOrgChildrenByParentOrgId", method = RequestMethod.GET)
    @ResponseBody
    Result<List<OrgNode>> getOrgChildrenByParentOrgId(@RequestParam("parentOrgId")Long parentOrgId);

    @ApiOperation(value = "外部系统手机号码登录")
    @RequestMapping(path = "/LoginController/loginExternalMobile", method = RequestMethod.POST)
    Result<Worker> loginExternalMobile(@RequestBody LoginInfoDto loginInfoDto);
    
    /**
     * 创建用户
     * 会传 用户名 密码 组织id
     * 用户名唯一，无电话
     * @author leixb
     * @since 2024-01-16 09:58
     * @param workerC workerC
     * @return Result<Integer>
     */
    @ApiOperation(value = "创建用户")
    @RequestMapping(path = "/auth/WorkerController/createWorkerCustomPwd", method = RequestMethod.POST)
    Result<Integer> createWorkerCustomPwd(@RequestBody @ApiParam WorkerC workerC);

}
