import { getLocaleText } from '@hed-hog/api-locale';
import { IsIn, IsString } from 'class-validator';
import { HttpMethod } from '../../types/http-method';

export class CreateDTO {
  @IsString({ message: (args) => getLocaleText('validation.urlMustBeString', args.value) })
  url: string;

  @IsString({ message: (args) => getLocaleText('validation.methodMustBeString', args.value) })
  @IsIn(['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS', 'HEAD'], {
    message: (args) => getLocaleText('validation.methodMustBeValid', args.value),
  })
  method: HttpMethod;
}
