import { Component, OnInit } from '@angular/core';
import { MainService } from 'src/app/services/main.service';

@Component({
  selector: 'app-instances-list',
  templateUrl: './instances-list.component.html',
  styleUrls: ['./instances-list.component.scss']
})
export class InstancesListComponent implements OnInit {
  subjects: string[] = [];

  stateitem: string[] = [];

  statevalue: string[] = [];

  shall: string[] = [];

  verb: string[] = [];

  quantifier: string[] = [];

  numunit: string[] = [];

  fifuintsysstatset: string[] = [];

  stsysconset: string[] = [];

  constructor(private mainService: MainService) { }

  ngOnInit(): void {
    this.getchoices();
  }

  getchoices(): void {
    this.mainService.getsubject()
      .subscribe(
        data => {
          for (let x = 0; x < data.length; x++) {
            this.subjects.push(data[x][1]);
          }
        },
        error => {
          console.log(error);
        });

    this.mainService.getstateitem()
      .subscribe(
        data => {
          //no data from State and Item
          //console.log(data);
          for (let x = 0; x < data.length; x++) {
            this.stateitem.push(data[x][1]);
          }
        },
        error => {
          console.log(error);
        });
    this.mainService.getstatevalue()
      .subscribe(
        data => {
          for (let x = 0; x < data.length; x++) {
            this.statevalue.push(data[x][1]);
          }
        },
        error => {
          console.log(error);
        });
    this.mainService.getshall()
      .subscribe(
        data => {
          for (let x = 0; x < data.length; x++) {
            this.shall.push(data[x][1]);
          }
        },
        error => {
          console.log(error);
        });
    this.mainService.getverb()
      .subscribe(
        data => {
          for (let x = 0; x < data.length; x++) {
            this.verb.push(data[x][1]);
          }
        },
        error => {
          console.log(error);
        });
    this.mainService.getquantifier()
      .subscribe(
        data => {
          for (let x = 0; x < data.length; x++) {
            this.quantifier.push(data[x][1]);
          }
        },
        error => {
          console.log(error);
        });
    //num
    this.mainService.getnumunit()
      .subscribe(
        data => {
          for (let x = 0; x < data.length; x++) {
            this.numunit.push(data[x][1]);
          }
        },
        error => {
          console.log(error);
        });
    this.mainService.getfifuintsysstatset()
      .subscribe(
        data => {
          for (let x = 0; x < data.length; x++) {
            this.fifuintsysstatset.push(data[x][1]);
          }
        },
        error => {
          console.log(error);
        });
    this.mainService.getstsysconset()
      .subscribe(
        data => {
          for (let x = 0; x < data.length; x++) {
            this.stsysconset.push(data[x][1]);
          }
        },
        error => {
          console.log(error);
        });
  }

}
