import { Product } from '../entities/Product';
import { Result } from '../shared/Result';

export class ProductNotFoundError extends Error {
  constructor(id: string) {
    super(`Product not found: ${id}`);
    this.name = 'ProductNotFoundError';
  }
}

export interface IProductRepository {
  findById(id: string): Promise<Result<Product, ProductNotFoundError>>;
  findAll(): Promise<Result<Product[], Error>>;
  save(product: Product): Promise<Result<Product, Error>>;
  delete(id: string): Promise<Result<void, Error>>;
}
