import { NgxSpinnerService } from 'ngx-spinner';
import { AuthServiceService } from './../../shared/auth-service.service';
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';

@Component({
  selector: 'app-footer',
  templateUrl: './footer.component.html',
  styleUrls: ['./footer.component.css']
})
export class FooterComponent implements OnInit {
  
  sectionLinks = [];
  awardsData = [];
  socialLinks = [];

  constructor(private authSer: AuthServiceService, 
    private spinner: NgxSpinnerService,
    private router: Router) { }

  ngOnInit() {
    // this.authSer.onGetFooterData().subscribe(
    //   (responce) => {
    //     console.log(responce);goPolicy
    //     this.sectionLinks = responce['footer']['links_section'];//
    //     this.awardsData = responce['footer']['awards_section'];//
    //     this.socialLinks = responce['footer']['socials_section'];
    //     console.log(this.sectionLinks);
    //   },
    //   (error) => {
    //     console.log(error);
    //   }
    // )
  }

  goPolicy(sectionData) {
    this.spinner.show();
    console.log(sectionData);
    if(sectionData.id == 20) {
      this.router.navigate(['ExternalPage/contactUs/' + sectionData.id]);
    } else if(sectionData.flag_page == 1) {
      this.router.navigate(['ExternalPage/externalPolicy/' + sectionData.id]);
    } else if(sectionData.id == 9) {
      this.router.navigate(['InternalPage/contactUs/' + sectionData.id]);
    } else if(sectionData.flag_page == 0) {
      this.router.navigate(['InternalPage/policy/' + sectionData.id]);
    }
  }

}
