import { Injectable } from '@angular/core' ; import { Language } from '@data/poe/schema' ; import { ContextService } from '../context' ; import { BaseItemCategoryService , BaseItemTypeService , ItemCategory } from './base-item-type' ; import { WordService } from './word' ; @ Injectable ( { providedIn : 'root' } ) export class ItemService { constructor ( private readonly context , private readonly baseItemTypeService , private readonly baseItemCategoryService , private readonly wordService ) { } public getNameType ( nameId , typeId , language ? ) { language = language || this . context . get ( ) . language ; return ( `${ this . getName ( nameId , language ) || '' } ${ this . getType ( typeId , language ) || '' }` ) . trim ( ) ; } public getName ( nameId , language ? ) { language = language || this . context . get ( ) . language ; const name = nameId ? this . wordService . translate ( nameId , language ) : '' ; return name ; } public getType ( typeId , language ? ) { language = language || this . context . get ( ) . language ; const type = typeId ? this . baseItemTypeService . translate ( typeId , language ) : '' ; return type ; } public getCategory ( typeId ) { return this . baseItemCategoryService . get ( typeId ) ; } }