import { CommonModule } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { CloudObject, CloudQuery } from 'src/lib/ncloud';
import { IonicModule, NavController } from '@ionic/angular';

@Component({
  selector: 'app-page-bird-display',
  templateUrl: './page-bird-display.component.html',
  styleUrls: ['./page-bird-display.component.scss'],
  imports: [CommonModule, IonicModule],
  standalone: true,
})
export class PageBirdDisplayComponent implements OnInit {
  bird: CloudObject | undefined | null;

  back() {
    this.navCtrl.back()
  }
  constructor(
    private route: ActivatedRoute,
    private navCtrl: NavController
  ) {
    this.route.params.subscribe(params => {
      console.log(params);
      this.loadBird(params['birdId']);
    });
  }

  async loadBird(birdId: string) {
    let query = new CloudQuery("Bird");
    this.bird = await query.get(birdId);
  }

  ngOnInit() { }
}