import { AiChannel } from "../../../generated/prisma/client";
import { IsBoolean, IsEnum, IsOptional, IsString, IsUrl, MinLength } from "class-validator";

export class UpsertAiProviderBindingDto {
  @IsEnum(AiChannel)
  channel!: AiChannel;

  @IsOptional()
  @IsString()
  @MinLength(1)
  providerName?: string;

  @IsOptional()
  @IsString()
  @MinLength(1)
  model?: string;

  @IsOptional()
  @IsString()
  @MinLength(1)
  configId?: string;

  @IsOptional()
  @IsString()
  @MinLength(1)
  configName?: string;

  @IsOptional()
  @IsUrl(
    {
      require_tld: false
    },
    {
      message: "endpoint \u5fc5\u987b\u662f\u5408\u6cd5\u7684 URL"
    }
  )
  endpoint?: string;

  @IsOptional()
  @IsString()
  @MinLength(1)
  apiKey?: string;

  @IsOptional()
  @IsBoolean()
  isEnabled?: boolean;
}
