import { NgFor, NgIf, NgSwitch, NgSwitchCase } from '@angular/common';
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { ActivatedRoute } from '@angular/router';
import { api } from '@enums/api.enum';
import { Roots } from '@enums/root.enum';
import { SanghProfileData } from '@interfaces/common';
import { IonicModule, NavController } from '@ionic/angular';
import { HttpRequestService } from '@services/http-request.service';


@Component({
    selector: 'app-create-new-sangh',
    templateUrl: './chaturmas-vihar.page.html',
    styleUrls: ['./chaturmas-vihar.page.scss'],
    standalone: true,
    imports: [IonicModule, NgIf, NgFor, FormsModule, NgSwitch, NgSwitchCase]
})
export class ViharSanghPage {
    viharType = 'chaturmas';
    sanghData: SanghProfileData;
    sanghId: string;

    constructor(
        private activatedRoute: ActivatedRoute,
        private navCtrl: NavController,
        private httpRequestService: HttpRequestService
    ) { }

    ngOnInit() {
        this.getProfileInfo();
    }

    getProfileInfo() {
        this.httpRequestService.get(api.sanghProfile.replace('{id}', this.activatedRoute.snapshot.paramMap.get('sanghId'))).then((res: any) => {
            this.sanghData = res.data;
        });
    }

    santProfile(santId) {
        this.navCtrl.navigateForward(Roots.page + '/' + Roots.santViewProfile.replace(':santId', santId));
    }

    onSant(): void {
        this.navCtrl.navigateForward(Roots.page + '/' + Roots.searchSant);
    }

}