def not_authenticated_response(): return JSONResponse( status_code=status.HTTP_400_BAD_REQUEST, content=fct.generate_error_dict( status=status.HTTP_400_BAD_REQUEST, key=NOT_AUTHENTICATED, message='Request requires valid authentication access token.'))
def invalid_token_res(): return JSONResponse( status_code=status.HTTP_400_BAD_REQUEST, content=fct.generate_error_dict( status=status.HTTP_400_BAD_REQUEST, key=INVALID_TOKEN, message='The submitted token could not be validated'))
def no_permission_response(): return JSONResponse( status_code=status.HTTP_400_BAD_REQUEST, content=fct.generate_error_dict( status=status.HTTP_400_BAD_REQUEST, key=NO_PERMISSION, message='User has no permission to access this action.'))
def invalid_purpose_id_response(usage_purpose: str): return JSONResponse(status_code=status.HTTP_400_BAD_REQUEST, content=fct.generate_error_dict( status=status.HTTP_400_BAD_REQUEST, key=INVALID_PURPOSE_ID, message=f'{usage_purpose} is invalid.'))
def user_exists_response(username: str): return JSONResponse(status_code=status.HTTP_400_BAD_REQUEST, content=fct.generate_error_dict( status=status.HTTP_400_BAD_REQUEST, key=USER_EXISTS, message=f'{username} username already exists.'))
def server_error_response(): return JSONResponse(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, content=fct.generate_error_dict( status=status.HTTP_500_INTERNAL_SERVER_ERROR, key=SERVER_ERROR, message='Something went wrong'))
def malformed_date_res(): return JSONResponse(status_code=status.HTTP_400_BAD_REQUEST, content=fct.generate_error_dict( status=status.HTTP_400_BAD_REQUEST, key=MALFORMED_DATE, message=f'Date format should be {db.DATE_FORMAT}'))
def no_record_found_res(): return JSONResponse(status_code=status.HTTP_400_BAD_REQUEST, content=fct.generate_error_dict( status=status.HTTP_400_BAD_REQUEST, key=NO_RECORD_FOUND, message='No record is available for this date'))
def wrong_password_response(): return JSONResponse(status_code=status.HTTP_400_BAD_REQUEST, content=fct.generate_error_dict( status=status.HTTP_400_BAD_REQUEST, key=WRONG_PASSWORD, message='The password is invalid'))
def user_not_found_response(username: str): return JSONResponse(status_code=status.HTTP_400_BAD_REQUEST, content=fct.generate_error_dict( status=status.HTTP_400_BAD_REQUEST, key=USER_NOT_FOUND, message=f'{username} does not exist'))