import api from '../utils/request'

export const getLoginRequest = (challenge: string) => {
  return api.get(`/oidc/login-request?challenge=${challenge}`)
}

export const acceptLogin = (challenge: string, loginData: any) => {
  return api.post(`/oidc/login/accept?challenge=${challenge}`, loginData)
}

export const getConsentRequest = (challenge: string) => {
  return api.get(`/oidc/consent-request?challenge=${challenge}`)
}

export const rejectLogin = (challenge: string, rejectData: { error: string; error_description?: string }) => {
  return api.post(`/oidc/login/reject?challenge=${challenge}`, rejectData)
}

export const rejectConsent = (challenge: string, rejectData: { error: string; error_description?: string }) => {
  return api.post(`/oidc/consent/reject?challenge=${challenge}`, rejectData)
}

export const getLogoutRequest = (challenge: string) => {
  return api.get(`/oidc/logout-request?challenge=${challenge}`)
}

export const acceptLogout = (challenge: string) => {
  return api.post(`/oidc/logout/accept?challenge=${challenge}`)
}