/**
 * Backward-compatible wrapper around useEntityTypes.
 * Preserves the original API surface (renamed fields) so consumers need no changes.
 */
import { useEntityTypes, type EntityType } from './useEntityTypes'
import type { ProductModelStructure } from '~/shared/types/inventory'
import type { Ref } from 'vue'

export interface ProductType extends EntityType {
  structure: ProductModelStructure | null
}

export function useProductTypes() {
  const { types, loading, loadTypes, createType, updateType, deleteType } = useEntityTypes({
    category: 'PRODUCT',
    label: 'produit',
  })

  return {
    productTypes: types as Ref<ProductType[]>,
    loadingProductTypes: loading,
    loadProductTypes: loadTypes,
    createProductType: createType,
    updateProductType: updateType,
    deleteProductType: deleteType,
  }
}
