import { IsString } from 'class-validator';
import { NotAcceptableError, NotFoundError } from 'routing-controllers';

/**
 * Error to throw when a donor couldn't be found.
 */
export class DonorNotFoundError extends NotFoundError {
	@IsString()
	name = "DonorNotFoundError"

	@IsString()
	message = "Donor not found!"
}

/**
 * Error to throw when two donors' ids don't match.
 * Usually occurs when a user tries to change a donor's id.
 */
export class DonorIdsNotMatchingError extends NotAcceptableError {
	@IsString()
	name = "DonorIdsNotMatchingError"

	@IsString()
	message = "The ids don't match! \n And if you wanted to change a donor's id: This isn't allowed!"
}

/**
 * Error to throw when a donor needs a receipt, but no address is associated with them.
 */
export class DonorReceiptAddressNeededError extends NotAcceptableError {
	@IsString()
	name = "DonorReceiptAddressNeededError"

	@IsString()
	message = "An address is needed to create a receipt for a donor. \n You didn't provide one."
}

/**
* Error to throw when a donor still has donations associated.
*/
export class DonorHasDonationsError extends NotAcceptableError {
	@IsString()
	name = "DonorHasDonationsError"

	@IsString()
	message = "This donor still has donations associated with it. \n If you want to delete this donor with all it's donations and teams add `?force` to your query."
}