import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { NGXLogger } from 'ngx-logger';
import { Company } from '@ucap-webmessenger/api-external';

@Component({
  selector: 'ucap-organization-tenant-search',
  templateUrl: './tenant-search.component.html',
  styleUrls: ['./tenant-search.component.scss']
})
export class TenantSearchComponent implements OnInit {
  @Input()
  companyList: Company[];

  @Input()
  companyCode: string;

  @Output()
  keyDownEnter = new EventEmitter<{
    companyCode: string;
    searchWord: string;
  }>();
  @Output()
  cancel = new EventEmitter<any>();

  constructor(private logger: NGXLogger) {}

  ngOnInit() {}

  onKeyDownEnter(searchWord: string) {
    this.keyDownEnter.emit({ companyCode: this.companyCode, searchWord });
  }

  onClickCancel() {
    this.cancel.emit();
  }
}
