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

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

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