import { ChangeDetectionStrategy, Component, input } from '@angular/core';
import { ProductImageDirective } from '@isa/shared/product-image';
import { ProductRouterLinkDirective } from '@isa/shared/product-router-link';
import { NgIcon, provideIcons } from '@ng-icons/core';
import { Product } from '@isa/oms/data-access';
import { LowerCasePipe } from '@angular/common';
import { ProductFormatIconGroup } from '@isa/icons';

/**
 * A reusable component that displays product information in a standardized format.
 * Used in return process workflows to show product details including image, name,
 * contributors, and format information.
 *
 * @example
 * ```html
 * <oms-shared-return-product-info
 *   [product]="product"
 * ></oms-shared-return-product-info>
 * ```
 */
@Component({
  selector: 'oms-shared-return-product-info',
  templateUrl: './return-product-info.component.html',
  styleUrls: ['./return-product-info.component.scss'],
  standalone: true,
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [
    ProductImageDirective,
    ProductRouterLinkDirective,
    NgIcon,
    LowerCasePipe,
  ],
  providers: [provideIcons({ ...ProductFormatIconGroup })],
})
export class ReturnProductInfoComponent {
  /** The product to display information for */
  product = input.required<Product>();
}
