import { ApiProperty } from "@nestjs/swagger";
import { Transform } from "class-transformer";
import { IsArray, IsBoolean, IsEmpty, IsEmail, IsEnum, IsNumber, IsOptional, IsString, isEnum, isString } from "class-validator";

export enum store_type {
    MEMBERSHIP = 'MEMBERSHIP',
    SUBSCRIPTION = 'SUBSCRIPTION',
}

export enum UsersType {
    USER = 'USER',
    DASHBOARD = 'DASHBOARD',
    ADMIN = 'ADMIN',
    STAFF = 'STAFF',
    SELLER = 'SELLER',
    CHEF="CHEF",
    DRIVER="DRIVER",
    FARMER="FARMER",
    AGENT="AGENT"
}

export class add_store1 {

    @IsOptional()
    @ApiProperty({ required: false, enum: Object.values(store_type), default: store_type.MEMBERSHIP })
    @IsString()
    type: string;

    @ApiProperty({ type: 'string', required: false, default: "John Doe" })
    @IsString()
    store_name: string;

    @ApiProperty({ type: 'string', required: false, default: "john_doe" })
    @IsString()
    address: string;

    @ApiProperty({ type: 'string', required: false, default: "john_doe" })
    @IsString()
    image: string;

    @ApiProperty({ type: 'string', required: false, default: "john_doe@yopmail.com" })
    // @IsEmail()
    country: string;

    @ApiProperty({ type: 'string', format: 'password', required: true, default: "qwerty" })
    @IsString()
    city: string;

    @ApiProperty({ type: 'string', format: 'password', required: true, default: "qwerty" })
    @IsString()
    state: string;

    @ApiProperty({ type: 'string', format: 'password', required: true, default: "qwerty" })
    @IsString()
    street_address: string;

    @ApiProperty({ type: 'string', format: 'password', required: true, default: "qwerty" })
    @IsString()
    description: string;

    @ApiProperty({ required: false })
    @IsNumber()
    postal_code: number

}


export class pagination_limit {

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

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

}


export class pagination_limit_search {

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

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

    @ApiProperty({ type: 'string', required: false, default: "John Doe" })
    @IsString()
    @IsOptional()
    search: string;

    @ApiProperty({ required: false, enum: Object.values(store_type), default: store_type.MEMBERSHIP })
    @IsString()
    @IsOptional()
    type: string;

}


export class pagination_limit_search_staff {

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

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

    @ApiProperty({ type: 'string', required: false, default: "John Doe" })
    @IsString()
    @IsOptional()
    search: string;

    @ApiProperty({ required: false, enum: Object.values(store_type), default: store_type.MEMBERSHIP })
    @IsString()
    @IsOptional()
    type: string;

    @ApiProperty({ required: false, enum: UsersType, default: UsersType.USER })
    @IsString()
    @IsOptional()
    filter: string;

}
