import { Effect, Context, Types, Option, Scope, Exit, Cause, Latch, Layer } from "effect"
import { SessionID, MessageID, PartID } from "../core/schema"
import { MessageV2 } from "../message/message-v2"
import type { PromptInput, ShellInput, CommandInput, LoopInput } from "./prompt-schemas"
import type { ModelID, ProviderID } from "../../provider/schema"

export interface Interface {
  readonly cancel: (sessionID: SessionID) => Effect.Effect<void>
  readonly prompt: (input: PromptInput) => Effect.Effect<MessageV2.WithParts>
  readonly loop: (input: LoopInput) => Effect.Effect<MessageV2.WithParts>
  readonly shell: (input: ShellInput) => Effect.Effect<MessageV2.WithParts>
  readonly command: (input: CommandInput) => Effect.Effect<MessageV2.WithParts>
  readonly resolvePromptParts: (template: string) => Effect.Effect<PromptInput["parts"]>
}

export class Service extends Context.Service<Service, Interface>()("@saeeol/SessionPrompt") {}

export interface PromptDeps {
  bus: any
  status: any
  sessions: any
  agents: any
  provider: any
  processor: any
  compaction: any
  plugin: any
  commands: any
  config: any
  permission: any
  fsys: any
  mcp: any
  lsp: any
  registry: any
  truncate: any
  spawner: any
  scope: Scope.Scope
  instruction: any
  state: any
  revert: any
  summary: any
  sys: any
  llm: any
  resolveToolsSvc: any
  userPartSvc: any
  subtaskSvc: any
  shellSvc: any
}
