import { IsEmail, IsNotEmpty, IsString, IsOptional, IsNumber, IsArray, ArrayNotEmpty, IsBoolean, IsEnum } from "class-validator";
import { ApiProperty } from '@nestjs/swagger';
import { Types } from 'mongoose';
import { Transform } from "class-transformer";

export class knowledgeBaseCreate {

    @ApiProperty({})
    @IsString()
    @IsOptional()
    name: string;

}

export class Upload {

    @ApiProperty({ type: 'string', format: 'binary' })
    file: any;

    @ApiProperty({ type: String })
    @IsString()
    @IsNotEmpty()
    knowledge_base_id: string;

}

export class AddTextDto {

    @ApiProperty()
    @IsString()
    text: string;

    @ApiProperty()
    @IsString()
    @IsOptional()
    title: string;

    @ApiProperty({ type: String })
    @IsString()
    knowledge_base_id: string;
}


export class getKnowledgeBase {

    @Transform(({ value }) => parseInt(value))
    @ApiProperty({ required: false })
    @IsNumber()
    @IsOptional()
    pagination: number;

    @Transform(({ value }) => parseInt(value))
    @ApiProperty({ required: false })
    @IsNumber()
    @IsOptional()
    limit: number;
}

export class getKnowledgeBaseDocument {

    @Transform(({ value }) => parseInt(value))
    @ApiProperty({ required: false })
    @IsNumber()
    @IsOptional()
    pagination: number;

    @Transform(({ value }) => parseInt(value))
    @ApiProperty({ required: false })
    @IsNumber()
    @IsOptional()
    limit: number;

    @ApiProperty({ required: false })
    @IsString()
    @IsOptional()
    search: string;
}


export class getAnswer {

    @ApiProperty()
    @IsString()
    query: string;

    @ApiProperty()
    @IsString()
    agent_id: string;

    @ApiProperty({ required: false })
    @IsString()
    @IsOptional()
    chat_history: string;

}

export class getLandingAnswer {

    @ApiProperty()
    @IsString()
    query: string;

    // @ApiProperty()
    // @IsString()
    // prompt: string;

    @ApiProperty()
    @IsString()
    voice: string;

    @ApiProperty()
    @IsString()
    chat_id: string;

    @ApiProperty()
    @IsString()
    agent_id?: string;

    @ApiProperty({ required: true })
    @IsString()
    secret_key: string;
}

export class urlUpload {

    @ApiProperty({ type: String })
    @IsString()
    knowledge_base_id: string;

    @ApiProperty()
    @IsString()
    url: string;

    @ApiProperty()
    @IsString()
    title: string;

    @ApiProperty()
    @IsNumber()
    depth?: number;
}