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

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

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

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

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

/**
 * Error to throw when a organization still has runners associated.
 */
export class RunnerOrganizationHasRunnersError extends NotAcceptableError {
	@IsString()
	name = "RunnerOrganizationHasRunnersError"

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

/**
 * Error to throw when a organization still has teams associated.
 */
export class RunnerOrganizationHasTeamsError extends NotAcceptableError {
	@IsString()
	name = "RunnerOrganizationHasTeamsError"

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

/**
 * Error to throw, when a provided runnerOrganization doesn't belong to the accepted types.
 */
export class RunnerOrganizationWrongTypeError extends NotAcceptableError {
	@IsString()
	name = "RunnerOrganizationWrongTypeError"

	@IsString()
	message = "The runner organization must be an existing organization's id. \n You provided a object of another type."
}
