import { AuthServiceService } from './auth-service.service';
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class InternalPageService {

  constructor(private http: HttpClient, private authSer: AuthServiceService) { }

  parentsPage = [];

  getParentData() {
    this.http.get(this.authSer.pathApi + '/main_menu_list').subscribe(
      (responce) => {
        this.parentsPage = responce['parents'];
      },
      (error) => {
        console.log(error);
      }
    );
  }

  getSliderData() {
    return this.http.get(this.authSer.pathApi + '/reports_list');
  }

  getExternalServicesList() {
    return this.http.get(this.authSer.pathApi + '/external_services_list_web');
  }

  getJoinUsData() {
    return this.http.get(this.authSer.pathApi + '/latest_join_us_user')
  }

  getCongatoration() {
    return this.http.get( this.authSer.pathApi + '/latest_event/1');
  }

  getCondolences() {
    return this.http.get( this.authSer.pathApi + '/latest_event/0');
  }

  getInternalServicesList() {
    return this.http.get(this.authSer.pathApi + '/internal_services_list');
  }

  getTabData(numberTab) {
    console.log(this.authSer.pathApi + '/forth_tabs_list/' + numberTab);
    return this.http.get(this.authSer.pathApi + '/forth_tabs_list/' + numberTab);
  }

  getForthAchievementsList(){
    return this.http.get(this.authSer.pathApi + '/forth_achievements_list');
  }

  getEventNow(){
   return this.http.get(this.authSer.pathApi + '/lectures_list'); 
  }

  //get data of hospital page 
  getHospitalCenterList() {
    return this.http.get(this.authSer.pathApi + '/hospitals_centers_list');
  }

  //get news data 
  getNewsData(id) {
    return this.http.get(this.authSer.pathApi + '/get_report/' + id);
  }

  //get Cir data 
  getCircularsData(currentPage: number, perPage: number, index: number) {
    return this.http.get(this.authSer.pathApi + '/tabs_list_internal_gate/' + currentPage + '/' + perPage + '/' + index);
  }
}
