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 agentCreate {

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

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

    @ApiProperty({})
    @IsString()
    @IsOptional()
    voice: string;

    @ApiProperty({})
    @IsString()
    @IsOptional()
    image: string;

    @ApiProperty({})
    @IsString()
    @IsOptional()
    chat_first_message: string;

    @ApiProperty({})
    @IsString()
    @IsOptional()
    chat_prompt: string;

    @ApiProperty({})
    @IsString()
    @IsOptional()
    call_first_message: string;

    @ApiProperty({})
    @IsString()
    @IsOptional()
    call_prompt: string;

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

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

    @ApiProperty({})
    @IsArray()
    @IsOptional()
    knowledge_base_id: string[];

    @ApiProperty({ required: false })
    @IsString()
    @IsOptional()
    ai_model: string

    @ApiProperty({ required: false })
    @IsBoolean()
    @IsOptional()
    idle_reminder: boolean

    @ApiProperty({ required: false })
    @IsBoolean()
    @IsOptional()
    call_cut_ability: boolean

    // @Prop({ type: String, default: null })
    // call_limit: string = null

    @ApiProperty({ required: false })
    @IsString()
    @IsOptional()
    call_limit_duration: string = null

    @ApiProperty({ required: false })
    @IsBoolean()
    @IsOptional()
    call_transfer: boolean

    @ApiProperty({ required: false })
    @IsBoolean()
    @IsOptional()
    send_message: boolean

    @ApiProperty({ required: false })
    @IsBoolean()
    @IsOptional()
    real_time_booking: boolean

    @ApiProperty({ required: false })
    @IsString()
    @IsOptional()
    ai_model_version: string

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

}

export class agentEdit {

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

    @ApiProperty({})
    @IsString()
    @IsOptional()
    image: string;

    @ApiProperty({})
    @IsString()
    @IsOptional()
    chat_first_message: string;

    @ApiProperty({})
    @IsString()
    @IsOptional()
    chat_prompt: string;

    @ApiProperty({})
    @IsString()
    @IsOptional()
    call_first_message: string;

    @ApiProperty({})
    @IsString()
    @IsOptional()
    call_prompt: string;
    
    @ApiProperty({})
    @IsArray()
    @IsOptional()
    knowledge_base_id: string[];

    @ApiProperty({ required: false })
    @IsString()
    @IsOptional()
    ai_model: string

    @ApiProperty({})
    @IsString()
    @IsOptional()
    voice: string;

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

}

export class get_agent {

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

export enum callType {
    CALL = "CALL",
    CHAT = "CHAT",
    VOICE_CHAT = "VOICE_CHAT"
}
export class get_agent_chat {
    
    @ApiProperty({ required: false, enum: callType, default: callType.CHAT })
    @IsEnum(callType)
    type: string;

    @ApiProperty({ required: false, default:null })
    @IsOptional()
    @IsString()
    search: string;

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

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

}

export class workspace_script_create {

    @ApiProperty()
    @IsString()
    workspace_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()
    workspace_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 workspace_script_status {

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


