import { Component, OnInit, Output, EventEmitter, Input, Host } from '@angular/core';
import { AccordinCustomComponent } from '../accordin-custom.component';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
@Component({
  selector: 'accordin-tab-custom',
  templateUrl: './accordin-tab-custom.component.html',
  styleUrls: ['./accordin-tab-custom.component.scss'],
})

export class AccordinTabCustomComponent implements OnInit {
  private accordion: AccordinCustomComponent;

  private id: number;
  public show = false;
  public direction = 'ltr';
  @Input() header: string;
  @Input() subHeader: string;
  @Input() cache = true;
  @Input() color = 'primary';
  @Input() subHeadergreen : true;

  @Output() selected = new EventEmitter();

  constructor(    public ts: TranslatorService
    ) { }


  ngOnInit() {
    this.direction = TranslatorService.getCurrentDirection();
  }

  public setVisibility(show: boolean) {
    this.show = show;
  }

  public setAccordion(accordion: AccordinCustomComponent) {
    this.accordion = accordion;
  }

  public onClick() {
    this.setVisibility(!this.show);
    if (this.show) {
      if (this.accordion) {
        this.accordion.tabClicked(this);
      }
    }

  }

}
