import { IsDate, IsEnum, IsNotEmpty, IsOptional, IsString } from "class-validator";
import { Type } from "class-transformer";
import { ProductStatus } from "../../../enums/product-status.enum";

export class ValidityDTO {
    @IsOptional()
    id?: string;

    @IsString()
    @IsNotEmpty()
    productId: string;

    @Type(() => Date)
    @IsDate({ message: "startDate must be a valid ISO date" })
    startDate: Date;

    @Type(() => Date)
    @IsDate({ message: "endDate must be a valid ISO date" })
    endDate: Date;

    @IsEnum(ProductStatus, { message: "Invalid status" })
    status: ProductStatus;
}
