package com.example.ops_android.data.remote

import com.google.gson.annotations.SerializedName

data class ApiResponse<T>(
    @SerializedName("return") val data: T? = null
) {
    @SerializedName("err_code")
    private val _errCode: Any? = null

    val errCode: Int
        get() = when (_errCode) {
            is Number -> (_errCode as Number).toInt()
            is String -> (_errCode as String).toIntOrNull() ?: -1
            else -> -1
        }

    val isSuccess: Boolean get() = errCode == 0
}

data class AuthRequest(
    @SerializedName("data") val data: Any?,
    @SerializedName("userCookieValue") val userCookieValue: String?
)
