import 'dart:convert';
import 'dart:io';

import 'package:http/http.dart' as http;

import '../models/info_empleado.dart';

class InfoEmpleadoProvider{
  final String _url = "smart.solerpalau.mx";

  Future<InfoEmpleado> fetchInfoEmpleado(String token, String dinum) async{
    final url = Uri.https(_url, 'PR/api/v1/quiosco/obtenerInfoEmpleado');
    final res = await http.post(url,
        headers: {
          HttpHeaders.authorizationHeader : "Bearer $token"
        },
        body: {
          "DINUM" : dinum
        }
    );

    final decodedData = jsonDecode(res.body);
    final info = InfoEmpleado.fromJson(decodedData);
    return info;
  }
}