package com.example.mysmartlab.Model

import com.google.gson.GsonBuilder
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.converter.scalars.ScalarsConverterFactory

object APIUse {

    val _URL =
        "https://iis.ngknn.ru/NGKNN/МамшеваЮС/MedicMadlab/"

    private val interceptor = HttpLoggingInterceptor()


    private val httpClient = OkHttpClient.Builder()
        .addInterceptor(interceptor)
        .build()

    private val gsonBuilder = GsonBuilder()
        .setLenient()
        .create()

    private val retrofit = Retrofit.Builder()
        .baseUrl(_URL)
        .client(httpClient)
        .addConverterFactory(ScalarsConverterFactory.create())
        .addConverterFactory(GsonConverterFactory.create(gsonBuilder))
        .build()


    val apiService: APIRequest
        get() = retrofit.create(APIRequest::class.java)
}
