import 'dart:convert';

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

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

  Future<Map<String, dynamic>> enviarDudas(
      String token,
      String ncli,
      String depa,
      String name,
      String corc,
      String asun,
      String ipco,
      String mens
      ) async{
    final url = Uri.https(_url, 'PR/api/v1/quiosco/enviarDudasComentarios');
    final res = await http.post(url,
        headers: {
          'Authorization' : 'Bearer $token'
        },
        body: {
          'NCLI' : ncli,
          'DEPA' : depa,
          'NAME' : name,
          'CORC' : corc,
          'ASUN' : asun,
          'IPCO' : ipco,
          'MENS' : mens
        }
    );

    final decodedData = jsonDecode(res.body);
    return {'error' : !decodedData['response'], 'mensaje' : decodedData['message']};
  }
}