import { ApiProperty } from "@nestjs/swagger";
import { IsDefined, IsIn, IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator";
import { EsQueryDto } from "./es-query.dto";
import { SearchQueryDto } from "./search-q.dto";

/**
 * List of allowed properties in this DTO
 */
const allowedProperties = ['query', 'es_query'];

/**
 * Request object, which contains query parameters and Elasticsearch query object
 */
export class RequestDto {
    /**
     * Query parameters object
     */
    @IsDefined()
    @IsNotEmpty()
    @ApiProperty({
        description: '',
        example: {}
    })
    query: SearchQueryDto;
    
    /**
     * Elasticsearch query object
     */
    @IsOptional()
    @ApiProperty({
        description: '',
        example: {},
    })
    es_query?: EsQueryDto;

     /**
      * Constructs an object with provided parameters
      * @param query
      * @param es_query
      */
     constructor(query: SearchQueryDto, es_query: EsQueryDto) {
        this.query = query;
        this.es_query = es_query;
     }
}