package com.zj365.health.fragment.bloodlipid

import kotlin.math.max
import kotlin.math.min

object BloodLipidGetMinMaxChart {
    fun getBloodLipidMax(maxValue: Float, maxCompareValue: Float): Float {
        val max = if (maxValue != 0f && maxCompareValue != 0f) {
            if (maxValue > maxCompareValue) {
                maxValue
            } else {
                maxCompareValue
            }
        } else if (maxValue == 0f && maxCompareValue != 0f) {
            maxCompareValue
        } else if (maxValue != 0f && maxCompareValue == 0f) {
            maxValue
        } else {
            max(maxValue, maxCompareValue)
        }
        return max
    }

    fun getBloodLipidMix(minValue: Float, minCompareValue: Float): Float {
        val mix = if (minValue != 0f && minCompareValue != 0f) {
            if (minValue > minCompareValue) {
                minCompareValue
            } else {
                minValue
            }
        } else if (minValue == 0f && minCompareValue != 0f) {
            minValue
        } else if (minValue != 0f && minCompareValue == 0f) {
            minCompareValue
        } else {
            min(minValue, minCompareValue)
        }
        return mix
    }
}