export class ProductSlugAlreadyExistsError extends Error {
  constructor() {
    super('Product slug already exists');
    this.name = 'ProductSlugAlreadyExistsError';
  }
}

export class ProductCategoryNotFoundError extends Error {
  constructor() {
    super('Product category not found');
    this.name = 'ProductCategoryNotFoundError';
  }
}

export class ProductBrandNotFoundError extends Error {
  constructor() {
    super('Product brand not found');
    this.name = 'ProductBrandNotFoundError';
  }
}

export type ProductVariantCode = 'sku' | 'ean';

export class ProductVariantCodeAlreadyExistsError extends Error {
  constructor(public readonly field?: ProductVariantCode) {
    super(field ? `Product variant ${field.toUpperCase()} already exists` : 'Product variant SKU or EAN already exists');
    this.name = 'ProductVariantCodeAlreadyExistsError';
  }
}

export class ProductImageVariantMismatchError extends Error {
  constructor() {
    super('Product image variant does not belong to product');
    this.name = 'ProductImageVariantMismatchError';
  }
}

export class ProductImageMainAlreadyExistsError extends Error {
  constructor() {
    super('Main product image already exists for this scope');
    this.name = 'ProductImageMainAlreadyExistsError';
  }
}
