import { Pipe, PipeTransform } from '@angular/core'; // interfaces import { IOptionModel } from '../interfaces/input-dropdown-option.interface'; @Pipe({ name: 'inputDropdownLoadBrokerContainer', standalone: true, }) export class InputDropdownLoadBrokerContainerPipe implements PipeTransform { transform( option: IOptionModel, options: IOptionModel[], activeItem: IOptionModel | null ): { [key: string]: boolean | undefined } { return { disabled: option?.disabled || option?.dnu || option?.ban || option?.availableCreditType?.name === 'Empty', 'no-result': options.length === 1 && options[0].type === 'no-results', 'add-new': option.type === 'add-new', active: option.id === activeItem?.id, }; } }