import { API_URL } from '../../config'
import { UserRatingResponse, UserRating } from './types'

const initialUserRating: UserRating = 0

const composeUserRatingURL = (userId: number) => (
    API_URL + '/user/rating?' + (new URLSearchParams({ user_id: userId.toString() })).toString()
)

const processUserRating = (data: UserRatingResponse): UserRating => {
    return data.rating
}

export { initialUserRating, composeUserRatingURL, processUserRating }
