import { ApiProperty } from "@nestjs/swagger";
import { IsNumber, IsString,IsOptional} from "class-validator";
import { Types } from "mongoose";
import { Transform } from "class-transformer";



export class add_category {
    @ApiProperty({ required: true })
    @IsString()
    name: string;

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

    

}



export class edit_category {
    @ApiProperty({ required: true })
    @IsString()
    category_id: string;

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

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

    
}


export class list_category{

    @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;

}