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



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

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


export class subcategory_list {
    @ApiProperty({ type: String, description: "search by title and caption", required: false })
    @IsString()
    @IsOptional()
    search?: string;

    @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()
    category_id: string;


}


export class edit_subcategory {
    @ApiProperty({ required: true })
    @IsString()
    subcategory_id: string;

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

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