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 { script_status } from "../../model/schema/script.workspace.schema";

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

export class vendorSignup {

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

    @ApiProperty({ default: "harman@yopmail.com" })
    @IsEmail({}, { message: 'Please enter a 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 vendorLogin {

    @ApiProperty({ default: "harman@yopmail.com" })
    @IsEmail({}, { message: 'Please enter a 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: "workspace one" })
    @IsNotEmpty()
    name: string;


    @ApiProperty({ default: "workspace description...." })
    @IsNotEmpty()
    description: string;


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

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


export class workspaceEdit {

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

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

}

export class adminData {
    user_data: any
}


export class editProfile {

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

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

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

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

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

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

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

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

    @ApiProperty()
    @IsBoolean()
    @IsOptional()
    ai_chat_notification: boolean;

    @ApiProperty()
    @IsBoolean()
    @IsOptional()
    ai_call_notification: boolean;

    @ApiProperty()
    @IsBoolean()
    @IsOptional()
    ai_human_notification: boolean;
}



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

    @ApiProperty({ required: false })
    @IsString()
    newPassword: 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;

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

}


export class message {

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

}


export class workspace_script_create {

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

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

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

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

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

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

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

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


export class workspace_script_edit {

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

    @IsString()
    name: 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;
}


export class white_list_form {

    @ApiProperty({
        required: true,
        description: 'The name of the vendor',
        type: String,
    })
    @IsString()
    name: string;

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

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

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

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

export class workspace_script_status {

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