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";
import { UserStatus } from "../../model/schema/user.schema";

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

export class vendorSignup {

    @ApiProperty({ default: null })
    @IsString()
    @IsOptional()
    name: string;

    @ApiProperty({ default: "admin@gmail.com" })
    @IsEmail({}, { message: 'Please enter valid email Address' },)
    @IsNotEmpty()
    email: string;

    @ApiProperty({ default: "qwerty" })
    @IsString()
    @IsNotEmpty()
    password: string;

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

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

    @ApiProperty()
    @IsString()
    @IsOptional()
    country_code: string;
}

export class Login {

    @ApiProperty({ default: "admin@gmail.com" })
    @IsEmail({}, { message: 'Please enter valid email Address' },)
    @IsNotEmpty()
    email: string;

    @ApiProperty({ default: "qwerty" })
    @IsString()
    @IsNotEmpty()
    password: string;

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

}

export class workspaceCreate {

    @ApiProperty({ default: null })
    @IsNotEmpty()
    name: string;

    @ApiProperty({ default: null })
    @IsNotEmpty()
    image: string;
}


export class workspaceEdit {

    @ApiProperty({ default: null })
    @IsNotEmpty()
    image: string;

    @ApiProperty({ default: null })
    @IsNotEmpty()
    name: string;

}

export class adminData {
    user_data: any
}



export class editProfileAdmin {

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

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

}



export enum type1 {
    YEAR = "YEAR",
    MONTH = "MONTH",
    WEAK = "WEAK",
    TODAY = "TODAY"
}

export class DashboardApi {

    @ApiProperty({ enum: type1, default: type1.YEAR })
    @IsString()
    type: string;

}


export class get_workspace {

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

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

export class get_vendor {

    @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: "" })
    @IsOptional()
    @IsString()
    search: string;

    @ApiProperty({ required: false, enum: UserStatus })
    @IsEnum(UserStatus)
    @IsString()
    status: string;
}

export class get_recent_vendor {

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

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


export enum workspace_status_enum {
    BLOCK = "BLOCK",
    UNBLOCK = "UNBLOCK",
}

export class workspace_status {

    @ApiProperty({ enum: workspace_status_enum, default: workspace_status_enum.BLOCK })
    @IsEnum(workspace_status_enum)
    @IsString()
    status: string;

}

export enum vendor_status_enum {
    BLOCK = "BLOCK",
    ACTIVE = "ACTIVE",
}

export class vendor_status {

    @ApiProperty({ enum: vendor_status_enum, default: vendor_status_enum.BLOCK })
    @IsEnum(vendor_status_enum)
    @IsString()
    status: string;

}

export class pl {

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

    @Transform(({ value }) => parseInt(value))
    @ApiProperty({ required: false })
    @IsNumber()
    @IsOptional()
    limit: number;
}
enum role_type {
    MEMBER = "MEMBER",
    ADMIN = "ADMIN",
}

export class vendor_email {

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

    @ApiProperty({ enum: role_type, default: role_type.ADMIN })
    @IsString()
    @IsEnum(role_type)
    role: string;

    @ApiProperty({ required: false })
    @IsArray()
    vendor_roles: [string];

}
export class vendor_password {

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

}
export class resend_invite {

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

export class adminChangePass {
    @ApiProperty({ required: false })
    @IsString()
    old_password: string;

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

}
export class verifyOtp {

    @ApiProperty({ required: false })
    @IsNumber()
    otp: number;

}

export class forgetPassword {

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

}

export class forgetPasswordOtpVerify {

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

    @ApiProperty({ required: false })
    @IsNumber()
    otp: number;
}

export class updateForgetPassword {

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

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

enum vendor_role_type {
    ACTIVE = "ACTIVE",
    DEACTIVE = "DEACTIVE",
}

export class workspace_role_change {

    @ApiProperty({ enum: role_type, default: role_type.ADMIN })
    @IsString()
    @IsEnum(role_type)
    role: string;

    @ApiProperty({ enum: vendor_role_type, default: vendor_role_type.ACTIVE })
    @IsString()
    status: string;

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

    @ApiProperty({ required: false })
    @IsArray()
    vendor_roles: [string];

}



export class contact_us {

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

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

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

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

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

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

}


export class message {

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

}


export class workspace_script_create {

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

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

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

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

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

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

    @ApiProperty()
    @IsString()
    font_colour: string;
}

export class get_script {

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

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

enum contact_type {
    RESOLVE = "RESOLVE",
    REJECT = "REJECT",
}

export class contact_us_edit {

    @ApiProperty({ enum: contact_type, default: contact_type.RESOLVE })
    @IsEnum(contact_type)
    @IsString()
    status: string;
}

export enum content_type {
    ABOUT_US = 'ABOUT_US',
    TERM_AND_CONDITION = 'TERM_AND_CONDITION',
    PRIVACY_POLICY = 'PRIVACY_POLICY',
    HELP_AND_SUPPORT = 'HELP_AND_SUPPORT'
}

export class AddContent {

    @ApiProperty({ type: String, default: "content.png", required: false })
    @IsString()
    image_url?: string;

    @ApiProperty({ type: String, default: "Title...", required: true })
    @IsEnum(content_type)
    @IsNotEmpty()
    title: string;

    @ApiProperty({ enum: content_type, type: String, default: "ABOUT_US", required: true })
    @IsEnum(content_type)
    @IsNotEmpty()
    page_type: string;

    @ApiProperty({ type: String, default: "content description", required: false })
    @IsString()
    description?: string;

    @ApiProperty({ type: String, default: "www.google.com", required: false })
    @IsString()
    page_url?: string;

    // @IsNumber()
    // @IsOptional()
    // created_at ? : number;

}
export class EditContent {

    @ApiProperty({ type: String, required: true })
    @IsString()
    _id?: string;

    @ApiProperty({ type: String, default: "content.png", required: false })
    @IsString()
    @IsOptional()
    image_url?: string;

    @ApiProperty({ type: String, default: "Title...", required: false })
    @IsEnum(content_type)
    @IsOptional()
    title?: string;

    @ApiProperty({ enum: content_type, type: String, default: "ABOUT_US", required: true })
    @IsEnum(content_type)
    @IsNotEmpty()
    page_type: string;

    @ApiProperty({ type: String, default: "content description", required: false })
    @IsString()
    @IsOptional()
    description?: string;

    @ApiProperty({ type: String, default: "www.google.com", required: false })
    @IsString()
    @IsOptional()
    page_url?: string;

    @IsNumber()
    @IsOptional()
    updated_at?: number;

}


export class ContentDetails {
    @ApiProperty({ type: String, default: null, required: true })
    @IsString()
    _id?: string;
}

export class ListContent {

    @ApiProperty({ enum: content_type, type: String, default: "ABOUT_US", required: false })
    @IsOptional()
    @IsEnum(content_type)
    // @IsNotEmpty()
    type?: string;

    @ApiProperty({ type: Number, default: 0, required: false })
    @IsOptional()
    pagination?: number;

    @ApiProperty({ type: Number, default: 10, required: false })
    @IsOptional()
    limit?: number;

    @IsBoolean()
    @IsOptional()
    is_deleted?: boolean;

}

export class get_subscription {

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

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

export class get_accounting {

    @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 })
    @IsOptional()
    @IsString()
    search: string;
}

export class get_white_label_list {

    @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 })
    @IsOptional()
    @IsString()
    search: string;
}

export enum bulk_notification_type {
    EMAIL = 'EMAIL',
    SMS = 'SMS',
    WEB = 'WEB',
}

export class bulk_notification {

    @ApiProperty({ required: true })
    @IsBoolean()
    is_send_to_all: boolean;

    @ApiProperty({ required: false })
    @IsOptional()
    @IsArray()
    vendor_ids: string[];

    @ApiProperty({ required: true, enum: bulk_notification_type, default: bulk_notification_type.EMAIL })
    @IsString()
    notification_type: string;

    @ApiProperty({ type: String, default: "Title...", required: true })
    @IsString()
    title: string;

    @ApiProperty({ type: String, default: "Notification description...", required: true })
    @IsString()
    description: string;
}

export class workspace_create {

    @ApiProperty({ required: true, default: "Admin Workspace" })
    @IsNotEmpty()
    name: string;

    @ApiProperty({ default: "Admin workspace used for website, call & chats" })
    @IsNotEmpty()
    description: string;

    @ApiProperty({ default: null })
    @IsNotEmpty()
    image: string;

    @ApiProperty({ required: true, default: "secret_xxxxxxxxxxxxxxxx"  })
    @IsNotEmpty()
    secret_key: string;
}