import Joi from "joi";
import { Result, RuleValidator } from "../../../../../common";

export interface ISetStatusQuote_Request_DTO {
  newStatus: string;
}

export function ensureSetStatusQuote_Request_DTOIsValid(quoteDTO: ISetStatusQuote_Request_DTO) {
  const schema = Joi.object({
    newStatus: Joi.string(),
  });

  const result = RuleValidator.validate<ISetStatusQuote_Request_DTO>(schema, quoteDTO);

  if (result.isFailure) {
    return Result.fail(result.error);
  }

  return Result.ok(true);
}
