// Code generated by internal/schemagen. DO NOT EDIT.

package schema

import (
	"encoding/json"
	"fmt"
)

// AgentNotification represents a [schema] type.
type AgentNotification struct {
	Method string `json:"method"`
	Params any    `json:"params,omitempty"`
}

// AgentRequest represents a [schema] type.
type AgentRequest struct {
	Id     *RequestId `json:"id"`
	Method string     `json:"method"`
	Params any        `json:"params,omitempty"`
}

type AgentResponse = any

// Describes an available authentication method.
// The `type` field acts as the discriminator in the serialized JSON form.
// When no `type` is present, the method is treated as `agent`
// TypeAuthMethodKind defines the values for TypeAuthMethodKind.
type TypeAuthMethodKind string

const (
	TypeAuthMethodKindAuthMethodAgent TypeAuthMethodKind = "agent"
)

// AuthMethod is a discriminated union.
type AuthMethod struct {
	Type            TypeAuthMethodKind `json:"type"`
	AuthMethodAgent *AuthMethodAgent   `json:"-"`
}

func (u AuthMethod) MarshalJSON() ([]byte, error) {
	switch u.Type {
	case TypeAuthMethodKindAuthMethodAgent:
		return marshalWith(u.AuthMethodAgent, "type", "agent")
	default:
		return json.Marshal(map[string]TypeAuthMethodKind{"type": u.Type})
	}
}

func (u *AuthMethod) UnmarshalJSON(data []byte) error {
	var raw map[string]json.RawMessage
	if err := json.Unmarshal(data, &raw); err != nil {
		return err
	}
	discrim, ok := raw["type"]
	if !ok {
		return fmt.Errorf("missing type field")
	}
	var dv string
	if err := json.Unmarshal(discrim, &dv); err != nil {
		return err
	}
	u.Type = TypeAuthMethodKind(dv)
	switch u.Type {
	case TypeAuthMethodKindAuthMethodAgent:
		u.AuthMethodAgent = &AuthMethodAgent{}
		return json.Unmarshal(data, u.AuthMethodAgent)
	default:
		return nil
	}
}

// Agent handles authentication itself.
// This is the default authentication method type
// AuthMethodAgent represents a [schema] type.
type AuthMethodAgent struct {
	// The _meta property is reserved by ACP to allow clients and agents to attach additional
	Meta Meta `json:"_meta,omitempty"`
	// Optional description providing more details about this authentication method
	Description *string `json:"description,omitempty"`
	// Unique identifier for this authentication method
	Id string `json:"id"`
	// Human-readable name of the authentication method
	Name string `json:"name"`
}

// ClientNotification represents a [schema] type.
type ClientNotification struct {
	Method string `json:"method"`
	Params any    `json:"params,omitempty"`
}

// ClientRequest represents a [schema] type.
type ClientRequest struct {
	Id     *RequestId `json:"id"`
	Method string     `json:"method"`
	Params any        `json:"params,omitempty"`
}

type ClientResponse = any

// Standard content block (text, images, resources)
// Content represents a [schema] type.
type Content struct {
	// The _meta property is reserved by ACP to allow clients and agents to attach additional
	Meta Meta `json:"_meta,omitempty"`
	// The actual content block
	Content *ContentBlock `json:"content"`
}

// A diff representing file modifications.
// Shows changes to files in a format suitable for display in the client UI.
// See protocol docs: [Content](https://agentclientprotocol.com/protocol/tool-calls#content)
// Diff represents a [schema] type.
type Diff struct {
	// The _meta property is reserved by ACP to allow clients and agents to attach additional
	Meta Meta `json:"_meta,omitempty"`
	// The new content after modification
	NewText string `json:"newText"`
	// The original content (None for new files)
	OldText *string `json:"oldText,omitempty"`
	// The file path being modified
	Path string `json:"path"`
}

// An environment variable to set when launching an MCP server
// EnvVariable represents a [schema] type.
type EnvVariable struct {
	// The _meta property is reserved by ACP to allow clients and agents to attach additional
	Meta Meta `json:"_meta,omitempty"`
	// The name of the environment variable
	Name string `json:"name"`
	// The value to set for the environment variable
	Value string `json:"value"`
}

type ErrorCode = any

type ExtNotification = any

type ExtRequest = any

type ExtResponse = any

// An HTTP header to set when making requests to the MCP server
// HttpHeader represents a [schema] type.
type HttpHeader struct {
	// The _meta property is reserved by ACP to allow clients and agents to attach additional
	Meta Meta `json:"_meta,omitempty"`
	// The name of the HTTP header
	Name string `json:"name"`
	// The value to set for the HTTP header
	Value string `json:"value"`
}

// Metadata about the implementation of the client or agent.
// Describes the name and version of an MCP implementation, with an optional
// title for UI representation
// Implementation represents a [schema] type.
type Implementation struct {
	// The _meta property is reserved by ACP to allow clients and agents to attach additional
	Meta Meta `json:"_meta,omitempty"`
	// Intended for programmatic or logical use, but can be used as a display
	Name string `json:"name"`
	// Intended for UI and end-user contexts — optimized to be human-readable
	Title *string `json:"title,omitempty"`
	// Version of the implementation. Can be displayed to the user or used
	Version string `json:"version"`
}

// Configuration for connecting to an MCP (Model Context Protocol) server.
// MCP servers provide tools and context that the agent can use when
// processing prompts.
// See protocol docs: [MCP Servers](https://agentclientprotocol.com/protocol/session-setup#mcp-servers)
// TypeMcpServerKind defines the values for TypeMcpServerKind.
type TypeMcpServerKind string

const (
	TypeMcpServerKindMcpServerHttp  TypeMcpServerKind = "http"
	TypeMcpServerKindMcpServerSse   TypeMcpServerKind = "sse"
	TypeMcpServerKindMcpServerStdio TypeMcpServerKind = "stdio"
)

// McpServer is a discriminated union.
type McpServer struct {
	Type           TypeMcpServerKind `json:"type"`
	McpServerHttp  *McpServerHttp    `json:"-"`
	McpServerSse   *McpServerSse     `json:"-"`
	McpServerStdio *McpServerStdio   `json:"-"`
}

func (u McpServer) MarshalJSON() ([]byte, error) {
	switch u.Type {
	case TypeMcpServerKindMcpServerHttp:
		return marshalWith(u.McpServerHttp, "type", "http")
	case TypeMcpServerKindMcpServerSse:
		return marshalWith(u.McpServerSse, "type", "sse")
	case TypeMcpServerKindMcpServerStdio:
		return marshalWith(u.McpServerStdio, "type", "stdio")
	default:
		return json.Marshal(map[string]TypeMcpServerKind{"type": u.Type})
	}
}

func (u *McpServer) UnmarshalJSON(data []byte) error {
	var raw map[string]json.RawMessage
	if err := json.Unmarshal(data, &raw); err != nil {
		return err
	}
	discrim, ok := raw["type"]
	if !ok {
		return fmt.Errorf("missing type field")
	}
	var dv string
	if err := json.Unmarshal(discrim, &dv); err != nil {
		return err
	}
	u.Type = TypeMcpServerKind(dv)
	switch u.Type {
	case TypeMcpServerKindMcpServerHttp:
		u.McpServerHttp = &McpServerHttp{}
		return json.Unmarshal(data, u.McpServerHttp)
	case TypeMcpServerKindMcpServerSse:
		u.McpServerSse = &McpServerSse{}
		return json.Unmarshal(data, u.McpServerSse)
	case TypeMcpServerKindMcpServerStdio:
		u.McpServerStdio = &McpServerStdio{}
		return json.Unmarshal(data, u.McpServerStdio)
	default:
		return nil
	}
}

// HTTP transport configuration for MCP
// McpServerHttp represents a [schema] type.
type McpServerHttp struct {
	// The _meta property is reserved by ACP to allow clients and agents to attach additional
	Meta Meta `json:"_meta,omitempty"`
	// HTTP headers to set when making requests to the MCP server
	Headers []*HttpHeader `json:"headers"`
	// Human-readable name identifying this MCP server
	Name string `json:"name"`
	// URL to the MCP server
	Url string `json:"url"`
}

// SSE transport configuration for MCP
// McpServerSse represents a [schema] type.
type McpServerSse struct {
	// The _meta property is reserved by ACP to allow clients and agents to attach additional
	Meta Meta `json:"_meta,omitempty"`
	// HTTP headers to set when making requests to the MCP server
	Headers []*HttpHeader `json:"headers"`
	// Human-readable name identifying this MCP server
	Name string `json:"name"`
	// URL to the MCP server
	Url string `json:"url"`
}

// Stdio transport configuration for MCP
// McpServerStdio represents a [schema] type.
type McpServerStdio struct {
	// The _meta property is reserved by ACP to allow clients and agents to attach additional
	Meta Meta `json:"_meta,omitempty"`
	// Command-line arguments to pass to the MCP server
	Args []string `json:"args"`
	// Path to the MCP server executable
	Command string `json:"command"`
	// Environment variables to set when launching the MCP server
	Env []*EnvVariable `json:"env"`
	// Human-readable name identifying this MCP server
	Name string `json:"name"`
}

// Meta is a map of arbitrary metadata attached to ACP messages.
type Meta = map[string]any

// Unique identifier for a permission option
// Unique identifier for a permission option
type PermissionOptionId = string

// The type of permission option being presented to the user.
// Helps clients choose appropriate icons and UI treatment
// PermissionOptionKind defines the values for PermissionOptionKind.
type PermissionOptionKind string

const (
	PermissionOptionKindAllowAlways  PermissionOptionKind = "allow_always"
	PermissionOptionKindAllowOnce    PermissionOptionKind = "allow_once"
	PermissionOptionKindRejectAlways PermissionOptionKind = "reject_always"
	PermissionOptionKindRejectOnce   PermissionOptionKind = "reject_once"
)

// Priority levels for plan entries.
// Used to indicate the relative importance or urgency of different
// tasks in the execution plan.
// See protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)
// PlanEntryPriority defines the values for PlanEntryPriority.
type PlanEntryPriority string

const (
	PlanEntryPriorityHigh   PlanEntryPriority = "high"
	PlanEntryPriorityLow    PlanEntryPriority = "low"
	PlanEntryPriorityMedium PlanEntryPriority = "medium"
)

// Status of a plan entry in the execution flow.
// Tracks the lifecycle of each task from planning through completion.
// See protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)
// PlanEntryStatus defines the values for PlanEntryStatus.
type PlanEntryStatus string

const (
	PlanEntryStatusCompleted  PlanEntryStatus = "completed"
	PlanEntryStatusInProgress PlanEntryStatus = "in_progress"
	PlanEntryStatusPending    PlanEntryStatus = "pending"
)

type RequestId = any

// The outcome of a permission request
// RequestPermissionOutcome defines the values for RequestPermissionOutcome.
type RequestPermissionOutcome string

const (
	RequestPermissionOutcomeCancelled RequestPermissionOutcome = "cancelled"
	RequestPermissionOutcomeSelected  RequestPermissionOutcome = "selected"
)

// The sender or recipient of messages and data in a conversation
// Role defines the values for Role.
type Role string

const (
	RoleAssistant Role = "assistant"
	RoleUser      Role = "user"
)

// The user selected one of the provided options
// SelectedPermissionOutcome represents a [schema] type.
type SelectedPermissionOutcome struct {
	// The _meta property is reserved by ACP to allow clients and agents to attach additional
	Meta Meta `json:"_meta,omitempty"`
	// The ID of the option the user selected
	OptionId *PermissionOptionId `json:"optionId"`
}

// Unique identifier for a session configuration option value group
// Unique identifier for a session configuration option value group
type SessionConfigGroupId = string

// Unique identifier for a session configuration option
// Unique identifier for a session configuration option
type SessionConfigId = string

// A session configuration option selector and its current state
// SessionConfigOption represents a [schema] type.
type SessionConfigOption struct {
	// The _meta property is reserved by ACP to allow clients and agents to attach additional
	Meta Meta `json:"_meta,omitempty"`
	// Optional semantic category for this option (UX only)
	Category *SessionConfigOptionCategory `json:"category,omitempty"`
	// Optional description for the Client to display to the user
	Description *string `json:"description,omitempty"`
	// Unique identifier for the configuration option
	Id *SessionConfigId `json:"id"`
	// Human-readable label for the option
	Name string `json:"name"`
}

// Semantic category for a session configuration option.
// This is intended to help Clients distinguish broadly common selectors (e.g. model selector vs
// session mode selector vs thought/reasoning level) for UX purposes (keyboard shortcuts, icons,
// placement). It MUST NOT be required for correctness. Clients MUST handle missing or unknown
// categories gracefully.
// Category names beginning with `_` are free for custom use, like other ACP extension methods.
// Category names that do not begin with `_` are reserved for the ACP spec
// SessionConfigOptionCategory defines the values for SessionConfigOptionCategory.
type SessionConfigOptionCategory string

const (
	SessionConfigOptionCategoryMode         SessionConfigOptionCategory = "mode"
	SessionConfigOptionCategoryModel        SessionConfigOptionCategory = "model"
	SessionConfigOptionCategoryThoughtLevel SessionConfigOptionCategory = "thought_level"
)

// A single-value selector (dropdown) session configuration option payload
// SessionConfigSelect represents a [schema] type.
type SessionConfigSelect struct {
	// The currently selected value
	CurrentValue *SessionConfigValueId `json:"currentValue"`
	// The set of selectable options
	Options *SessionConfigSelectOptions `json:"options"`
}

type SessionConfigSelectOptions = any

// Unique identifier for a session configuration option value
// Unique identifier for a session configuration option value
type SessionConfigValueId = string

// A unique identifier for a conversation session between a client and agent.
// Sessions maintain their own context, conversation history, and state,
// allowing multiple independent interactions with the same agent.
// See protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)
// A unique identifier for a conversation session between a client and agent
type SessionId = string

// Information about a session returned by session/list
// SessionInfo represents a [schema] type.
type SessionInfo struct {
	// The _meta property is reserved by ACP to allow clients and agents to attach additional
	Meta Meta `json:"_meta,omitempty"`
	// The working directory for this session. Must be an absolute path
	Cwd string `json:"cwd"`
	// Unique identifier for the session
	SessionId *SessionId `json:"sessionId"`
	// Human-readable title for the session
	Title *string `json:"title,omitempty"`
	// ISO 8601 timestamp of last activity
	UpdatedAt *string `json:"updatedAt,omitempty"`
}

// Unique identifier for a Session Mode
// Unique identifier for a Session Mode
type SessionModeId = string

// Reasons why an agent stops processing a prompt turn.
// See protocol docs: [Stop Reasons](https://agentclientprotocol.com/protocol/prompt-turn#stop-reasons)
// StopReason defines the values for StopReason.
type StopReason string

const (
	StopReasonCancelled       StopReason = "cancelled"
	StopReasonEndTurn         StopReason = "end_turn"
	StopReasonMaxTokens       StopReason = "max_tokens"
	StopReasonMaxTurnRequests StopReason = "max_turn_requests"
	StopReasonRefusal         StopReason = "refusal"
)

// Embed a terminal created with `terminal/create` by its id.
// The terminal must be added before calling `terminal/release`.
// See protocol docs: [Terminal](https://agentclientprotocol.com/protocol/terminals)
// Terminal represents a [schema] type.
type Terminal struct {
	// The _meta property is reserved by ACP to allow clients and agents to attach additional
	Meta       Meta   `json:"_meta,omitempty"`
	TerminalId string `json:"terminalId"`
}

// Exit status of a terminal command
// TerminalExitStatus represents a [schema] type.
type TerminalExitStatus struct {
	// The _meta property is reserved by ACP to allow clients and agents to attach additional
	Meta Meta `json:"_meta,omitempty"`
	// The process exit code (may be null if terminated by signal)
	ExitCode *int `json:"exitCode,omitempty"`
	// The signal that terminated the process (may be null if exited normally)
	Signal *string `json:"signal,omitempty"`
}

// Unique identifier for a tool call within a session
// Unique identifier for a tool call within a session
type ToolCallId = string

// A file location being accessed or modified by a tool.
// Enables clients to implement "follow-along" features that track
// which files the agent is working with in real-time.
// See protocol docs: [Following the Agent](https://agentclientprotocol.com/protocol/tool-calls#following-the-agent)
// ToolCallLocation represents a [schema] type.
type ToolCallLocation struct {
	// The _meta property is reserved by ACP to allow clients and agents to attach additional
	Meta Meta `json:"_meta,omitempty"`
	// Optional line number within the file
	Line *int `json:"line,omitempty"`
	// The file path being accessed or modified
	Path string `json:"path"`
}

// Execution status of a tool call.
// Tool calls progress through different statuses during their lifecycle.
// See protocol docs: [Status](https://agentclientprotocol.com/protocol/tool-calls#status)
// ToolCallStatus defines the values for ToolCallStatus.
type ToolCallStatus string

const (
	ToolCallStatusCompleted  ToolCallStatus = "completed"
	ToolCallStatusFailed     ToolCallStatus = "failed"
	ToolCallStatusInProgress ToolCallStatus = "in_progress"
	ToolCallStatusPending    ToolCallStatus = "pending"
)

// Categories of tools that can be invoked.
// Tool kinds help clients choose appropriate icons and optimize how they
// display tool execution progress.
// See protocol docs: [Creating](https://agentclientprotocol.com/protocol/tool-calls#creating)
// ToolKind defines the values for ToolKind.
type ToolKind string

const (
	ToolKindDelete     ToolKind = "delete"
	ToolKindEdit       ToolKind = "edit"
	ToolKindExecute    ToolKind = "execute"
	ToolKindFetch      ToolKind = "fetch"
	ToolKindMove       ToolKind = "move"
	ToolKindOther      ToolKind = "other"
	ToolKindRead       ToolKind = "read"
	ToolKindSearch     ToolKind = "search"
	ToolKindSwitchMode ToolKind = "switch_mode"
	ToolKindThink      ToolKind = "think"
)

// All text that was typed after the command name is provided as input
// UnstructuredCommandInput represents a [schema] type.
type UnstructuredCommandInput struct {
	// The _meta property is reserved by ACP to allow clients and agents to attach additional
	Meta Meta `json:"_meta,omitempty"`
	// A hint to display when the input hasn't been provided yet
	Hint string `json:"hint"`
}
