#!/bin/bash


main(){
	local EMAIL=${1};
	if [ -z "${EMAIL}" ]; then
		echo "first argument must be an EMAIL address"
		exit 1;
	fi

	local PASSWORD=${2};
	if [ -z "${PASSWORD}" ]; then
		echo "second argument must be a PASSWORD"
		exit 1;
	fi

	local ROLE=${3:-USER};
	local HOST=${4:-"http://bh.localhost:8000"};

	curl -X PUT -H 'Content-Type: application/json' \
		-d "{ \"email\":\"${EMAIL}\", \"password\":\"${PASSWORD}\", \"role\":\"${ROLE}\" }" \
		"${HOST}/api/v1/user";
}


main $@;
