import { FastifyRequest } from "fastify";
import validate from "validate.js";
import { IAuthMiddlewareParams } from "../middleware/auth";
import { RequestMovieRequest } from "./RequestMovieRequest";

export class RequestTmdbMovieRequest<T extends IAuthMiddlewareParams> extends RequestMovieRequest<T>
{
	public validate(request: FastifyRequest) {
		return validate.async(request.params, {
			tmdb_id: {
				presence: {
					allowEmpty: false,
					message: "TMDb ID is required"
				},
				numericality: {
					onlyInteger: true,
					greaterThanOrEqualTo: 0,
					notInteger: "Invalid TMDb ID",
					notGreaterThanOrEqualTo: "Invalid TMDb ID"
				}
			}
		},<any>{ fullMessages: false });
	}
}
