import { Component, Input, Output, EventEmitter } from '@angular/core';
import { FormControl } from '@angular/forms';
import { SpfValuePair } from '@softpak/frontend-components/dist/types';

@Component({
  selector: 'spa-company-selection',
  template: `<spf-form-section [spfTitle]="txtChannel" [spfIndex]="2">
  <div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3">
    <spn-input [formControl]="control" [spfLabel]="txtCompany"
      [spfType]="'radio'" [spfSuggestions]="options"></spn-input>
  </div>
</spf-form-section>`,
})
export class SpaCompanySelectionComponent {
  @Input() control!: FormControl;
  @Input() options?: SpfValuePair<string>[] = [];
  @Input() txtChannel!: string;
  @Input() txtCompany!: string;
  @Output() spaChange: EventEmitter<void> = new EventEmitter<void>();

  constructor(
  ) { }

  onChange() {
    this.spaChange.emit();
  }
}
