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

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

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

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

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

/**
 * Error to throw when a track's lap time is set to a negative value.
 */
export class TrackLapTimeCantBeNegativeError extends NotAcceptableError {
	@IsString()
	name = "TrackLapTimeCantBeNegativeError"

	@IsString()
	message = "The minimum lap time you provided is negative - That isn't possible. \n If you wanted to disable it: Just set it to 0/null."
}

export class TrackHasScanStationsError extends NotAcceptableError {
	@IsString()
	name = "TrackHasScanStationsError"

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