package client

import (
	"context"
	"errors"

	"github.com/keepmind9/acp-sdk-go/schema"
)

// ErrNotSupported is returned by optional Client methods that are not implemented.
var ErrNotSupported = errors.New("not supported")

// Base implements all Client interface methods with default (not-supported) responses.
// Embed it in your client struct to inherit these defaults and override only the
// methods you need.
//
// All methods are optional by default; override those you support.
type Base struct{}

// RequestPermission returns ErrNotSupported by default.
func (*Base) RequestPermission(_ context.Context, _ *schema.RequestPermissionRequest) (*schema.RequestPermissionResponse, error) {
	return nil, ErrNotSupported
}

// SessionUpdate is a no-op by default.
func (*Base) SessionUpdate(_ context.Context, _ *schema.SessionNotification) error {
	return nil
}

// ReadTextFile returns ErrNotSupported by default.
func (*Base) ReadTextFile(_ context.Context, _ *schema.ReadTextFileRequest) (*schema.ReadTextFileResponse, error) {
	return nil, ErrNotSupported
}

// WriteTextFile returns ErrNotSupported by default.
func (*Base) WriteTextFile(_ context.Context, _ *schema.WriteTextFileRequest) (*schema.WriteTextFileResponse, error) {
	return nil, ErrNotSupported
}

// CreateTerminal returns ErrNotSupported by default.
func (*Base) CreateTerminal(_ context.Context, _ *schema.CreateTerminalRequest) (*schema.CreateTerminalResponse, error) {
	return nil, ErrNotSupported
}

// TerminalOutput returns ErrNotSupported by default.
func (*Base) TerminalOutput(_ context.Context, _ *schema.TerminalOutputRequest) (*schema.TerminalOutputResponse, error) {
	return nil, ErrNotSupported
}

// ReleaseTerminal returns ErrNotSupported by default.
func (*Base) ReleaseTerminal(_ context.Context, _ *schema.ReleaseTerminalRequest) (*schema.ReleaseTerminalResponse, error) {
	return nil, ErrNotSupported
}

// WaitForTerminalExit returns ErrNotSupported by default.
func (*Base) WaitForTerminalExit(_ context.Context, _ *schema.WaitForTerminalExitRequest) (*schema.WaitForTerminalExitResponse, error) {
	return nil, ErrNotSupported
}

// KillTerminal returns ErrNotSupported by default.
func (*Base) KillTerminal(_ context.Context, _ *schema.KillTerminalRequest) (*schema.KillTerminalResponse, error) {
	return nil, ErrNotSupported
}

// ExtMethod is a no-op returning ErrNotSupported by default.
func (*Base) ExtMethod(_ context.Context, name string, _ map[string]any) (any, error) {
	return nil, ErrNotSupported
}

// ExtNotification is a no-op by default.
func (*Base) ExtNotification(_ context.Context, _ string, _ map[string]any) error {
	return nil
}

// OnConnect is a no-op by default.
func (*Base) OnConnect(_ *ClientSideConnection) {}
