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 urlUpload {

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

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

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

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

export class AddTextDto {
    @ApiProperty()
    @IsString()
    text: string;

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

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

export class Upload {

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

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

export class knowledgeBaseCreate {

    @ApiProperty({})
    @IsString()
    @IsOptional()
    name: 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;

    @ApiProperty({ required: false, default: ""})
    @IsString()
    @IsOptional()
    search?: string;
}