import { Component, OnInit } from '@angular/core';

import { SearchService } from 'app/search/service/search-service';

@Component({
  selector: 'jhi-teaser-content',
  templateUrl: './teaserContent.component.html',
  styleUrls: ['./teaserContent.component.scss']
})

export class TeaserContentComponent implements OnInit {

  public keywords: Array<String> = new Array<String>();
  public contributors: Array<String> = new Array<String>();
  public programmingLanguages: Array<String> = new Array<String>();

  constructor(
    private searchService: SearchService
	) { }

  ngOnInit(): void {
	
	this.searchService.getKeywordsAutoComplete('')
		 .subscribe(
			        (data: Array<string>) => {
						this.keywords = data;
			          }
			        ,
			        () => {alert("Initializiation of keywords failed");}
			      );

	this.searchService.getProgrammingLanguageAutoComplete('')
		 .subscribe(
			        (data: Array<string>) => {
						this.programmingLanguages = data;
			          }
			        ,
			        () => {alert("Initializiation of programming languages failed");}
			      );
	this.searchService.getContributorAutoComplete('')
		 .subscribe(
			        (data: Array<string>) => {
						this.contributors = data;
			          }
			        ,
			        () => {alert("Initializiation of contributors failed");}
			      );
  }

}