import { HttpService } from "@nestjs/axios";
import { Injectable } from "@nestjs/common";
import type { AgentProviderConfig } from "@prisma/client";
import { EncryptionService } from "../../../security/encryption.service";
import { OpenClawSseBridge } from "./openclaw-sse.bridge";
import { OpenClawProvider } from "./openclaw.provider";

@Injectable()
export class OpenClawProviderFactory {
  constructor(
    private readonly encryptionService: EncryptionService,
    private readonly httpService: HttpService,
    private readonly openClawSseBridge: OpenClawSseBridge
  ) {}

  createProvider(config: AgentProviderConfig): OpenClawProvider {
    return new OpenClawProvider(
      config,
      this.encryptionService,
      this.httpService,
      this.openClawSseBridge
    );
  }
}
