/**
 * Service Contract
 *
 * Orchestration boundary for server-side operations.
 * Services are self-contained and create their own dependencies.
 * Returns Result<ApiDto, DomainError> for type-safe error handling.
 * Must be stateless.
 *
 * Architecture:
 * - Services are self-contained (no constructor parameters)
 * - Services create their own dependencies (API Client, Logger, ErrorReporter)
 * - Services return Result<ApiDto, DomainError>
 * - Services convert HTTP errors to Domain errors
 *
 * Based on WEBSITE_CONTRACT.md:
 * - Services orchestrate IO and composition
 * - They do not prepare UI
 * - They return Result<ApiDto, DomainError>
 */


/**
 * Domain error type for services
 * Services should define specific error types based on their domain
 */
export type DomainError =
  | { type: 'notFound'; message: string }
  | { type: 'unauthorized'; message: string }
  | { type: 'forbidden'; message: string }
  | { type: 'validation'; message: string }
  | { type: 'serverError'; message: string }
  | { type: 'networkError'; message: string }
  | { type: 'notImplemented'; message: string }
  | { type: 'unknown'; message: string };

/**
 * Service interface for orchestration operations
 *
 * Design Decision: Services with multiple methods CANNOT use a single generic type
 * because each method may return different DTOs. Instead:
 *
 * 1. Single-method services (PageQueries, Mutations): Use Service<TApiDto, TError>
 * 2. Multi-method services: Don't implement this interface, just follow the pattern
 *
 * All service methods must return Promise<Result<T, DomainError>> for type-safe error handling.
 *
 * Type Parameters:
 * - TApiDto: The API Transport DTO type returned on success
 * - TError: The domain error type (defaults to DomainError)
 */
export interface Service {
  // No specific methods - just a marker type
}