package com.aluracursos.screenmatch;
import com.aluracursos.screenmatch.model.DatosSerie;
import com.aluracursos.screenmatch.service.ConsumoAPI;
import com.aluracursos.screenmatch.service.ConvierteDatos;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ScreenmatchApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(ScreenmatchApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
var consumoAPI = new ConsumoAPI();
var json = consumoAPI.obtenerDatos("https://www.omdbapi.com/?t=game+of+thrones&apikey=4fc7c187");
System.out.println(json);
ConvierteDatos conversor = new ConvierteDatos();
var datos = conversor.obtenerDatos(json, DatosSerie.class);
System.out.println(datos.titulo());
System.out.println(datos.totalDeTemporadas());
System.out.println(datos.evaluacion());
}
}