import { request } from "./client";

export interface UserBrief {
  iIncrement: number;
  sUserNo: string;
  sUserName: string;
  sUserType: string;
  sLanguage: string;
}

export interface LoginResponse {
  accessToken: string;
  refreshToken: string;
  expiresIn: number;
  user: UserBrief;
}

export function login(
  sUserName: string,
  password: string,
  version: string
): Promise<LoginResponse> {
  return request<LoginResponse>({
    url: "/usr/auth/login",
    method: "POST",
    data: { sUserName, password, version },
  });
}
