package com.neusoft.smart.pos.gateway.service.feignService;

import com.neusoft.smart.pos.dto.AlterUserRequest;
import com.neusoft.smart.pos.dto.user.CreateUserRequest;
import com.neusoft.smart.pos.dto.user.Permission;
import com.neusoft.smart.pos.dto.user.User;
import com.neusoft.smart.pos.framework.dto.ResponseData;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

@FeignClient(value = "service-user")
public interface RemoteUserService {
    @GetMapping("/user")
    User getUser(@RequestParam("username") String username);

    @GetMapping("/user/permissions")
    List<Permission> getPermissions(@RequestParam("username") String username);


    @PostMapping("/user/createUser")
    ResponseData<Integer> createUser(@Valid @RequestBody CreateUserRequest createUserRequest);

    @GetMapping("/user/loadUserData2Redis")
    String loadUserData2Redis();

    @PostMapping("/user/alter")
    ResponseData alterUser(@RequestBody AlterUserRequest alterUserRequest);

    @PostMapping("/permission/checked/{id}")
    ResponseData permissionChecked(@PathVariable("id") Integer id, @RequestBody List<Integer> checked);

    @GetMapping("/user/loadUserData2RedisByShop")
    String loadUserData2RedisByShop(@RequestParam("shopId") Integer shopId);

    @GetMapping("/user/loadUserData2RedisByOrg")
    String loadUserData2RedisByOrg(@RequestParam("orgId") Integer orgId);
}
