package com.judong.chuanyiserver.service;

import com.judong.chuanyiserver.entity.Permission;
import com.judong.chuanyiserver.entity.Role;
import com.judong.chuanyiserver.entity.User;
import com.judong.chuanyiserver.util.Result;

import java.util.List;

public interface UserService {

    /**
     * 前端用户登录
     *
     * @param user
     * @return
     */
    Result frontUserLogin(User user);

    /**
     * 后台管理系统登录
     *
     * @param user
     * @return
     */
    Result backUserLogin(User user);

    /**
     * 添加用户
     *
     * @param userName
     * @param password
     * @return
     */
    Result addUser(String userName, String password);

    /**
     * 新增角色
     *
     * @param roleName
     * @return
     */
    Result addRole(String roleName);


    Result assignRole(String userId, List<Role> roleList);

    Result userLoginOut();

    Result getUserPage(int page, int limit);

    Result getUserById(String userId);

    Result updateUserStateById(String userId, Integer userState);

    Result updateUser(User user);

    Result updateRole(Role role);

    Result getRoleListByPage(Integer page, Integer limit);

    Result getRoleById(Integer id);

    Result addPermission(Permission permission);

    Result updatePermission(Permission permission);

    Result getPermissionById(Integer id);

    Result getPermissionListByPage(Integer page, Integer limit);

    Result deletePermissionById(Integer id);

    Result assignPermission(int roleId, List<Permission> permissionList);

    Result getCodeImage(boolean hasPubKey);
}
