import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { addIcons } from 'ionicons';
import { basketOutline, bookmark, bookmarkOutline, flameOutline, peopleOutline, restaurantOutline, shareSocialOutline, star, starOutline, timeOutline } from 'ionicons/icons';
import { CloudObject, CloudQuery } from 'src/lib/ncloud';

@Component({
  selector: 'app-page-selectlist-detail',
  templateUrl: './page-selectlist-detail.page.html',
  styleUrls: ['./page-selectlist-detail.page.scss'],
  standalone: false
})
export class PageSelectlistDetailPage implements OnInit {
  constructor(
    private route: ActivatedRoute
  ) {
    addIcons({ timeOutline, 
      flameOutline, 
      peopleOutline, 
      basketOutline, 
      restaurantOutline,
      star,
      starOutline,
      bookmark,
      bookmarkOutline,
      shareSocialOutline });
    this.route.params.subscribe(params => {
     console.log(params) ;
     this.loadRecipe(params['recipeId']);
    })
  }

  recipe : CloudObject | undefined |null;

  async loadRecipe(recipeId: string) {
    let query = new CloudQuery("Recipe");
    this.recipe = await query.get(recipeId);
    console.log(this.recipe);
  }

  ngOnInit() {
  }
}
