import type { DomainErrorProps } from '../errors/DomainError';
import { Result } from './Result';

export interface DomainService {
  readonly serviceName?: string;
}

export interface DomainCalculationService<Input, Output> extends DomainService {
  calculate(input: Input): Output;
}

export interface ResultDomainCalculationService<Input, Output, Error = DomainErrorProps>
  extends DomainService {
  calculate(input: Input): Result<Output, Error>;
}

export interface DomainValidationService<Input, Output, Error = DomainErrorProps>
  extends DomainService {
  validate(input: Input): Result<Output, Error>;
}

export interface DomainFactoryService<Input, Output> extends DomainService {
  create(input: Input): Output;
}

// Alias for backward compatibility
export type DomainServiceAlias = DomainService;
export type DomainCalculationServiceAlias<Input, Output> = DomainCalculationService<Input, Output>;
export type ResultDomainCalculationServiceAlias<Input, Output, Error = DomainErrorProps> = ResultDomainCalculationService<Input, Output, Error>;
export type DomainValidationServiceAlias<Input, Output, Error = DomainErrorProps> = DomainValidationService<Input, Output, Error>;
export type DomainFactoryServiceAlias<Input, Output> = DomainFactoryService<Input, Output>;
