import { CommonModule } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { ServicesComponent } from '../services/services.component';
import { FormsModule } from '@angular/forms';
import { Service } from '../components';
@Component({
  selector: 'app-setting-widget',
  standalone: true,
  imports: [CommonModule, ServicesComponent, FormsModule],
  templateUrl: './setting-widget.component.html',
  styleUrls: ['./setting-widget.component.css']
})
export class SettingWidgetComponent implements OnInit {
  widgetModel?: Service
  widjetId = 0
  dataSoure: string = "";
  model: string = "";
  resp: string = ""
  constructor() { }

  ngOnInit() {
  }

  onValueChange(value: Service) {
    console.log("value", value)
    if (value) {
      this.widgetModel = value
      this.dataSoure = value.api
      this.resp = value.dataSoure
      this.model = value.dataModel
    }else{
      this.widgetModel = undefined
      this.dataSoure = ""
      this.resp = ""
      this.model = ""
    }

  }

}