package com.dahe.mylibrary.utils

import android.content.Context
import com.dahe.mylibrary.base.BaseSingleton
import com.dahe.mylibrary.weight.GlideEngine
import com.dahe.mylibrary.weight.ImageFileCompressEngine
import com.luck.picture.lib.basic.PictureSelectionModel
import com.luck.picture.lib.basic.PictureSelector
import com.luck.picture.lib.config.SelectMimeType
import com.luck.picture.lib.entity.LocalMedia

/**
 * @ClassName SelectPicUtils
 * @Author john
 * @Date 2024/1/31 10:20
 * @Description TODO
 */
class SelectPicUtils private constructor(
    private val maxNum: Int,
    private val minNum: Int,
    private val isDisplayCamera: Boolean
) {

    private constructor(builder: Builder) : this(
        builder.maxNum,
        builder.minNum,
        builder.isDisplayCamera
    )

    class Builder {
        var maxNum: Int = 6
            private set
        var minNum: Int = 1
            private set
        var isDisplayCamera: Boolean = true
            private set

        var listener: onPicResultListener? = null
            private set


        fun setMaxNum(maxNum: Int) = apply {
            this.maxNum = maxNum
        }

        fun setMinNum(setMinNum: Int) = apply {
            this.minNum = setMinNum
        }

        fun setiIsDisplayCamera(isDisplayCamera: Boolean) = apply {
            this.isDisplayCamera = isDisplayCamera
        }

        fun setOnPicResultListener(listener : onPicResultListener)= apply {
            this.listener = listener
        }

        fun build() = SelectPicUtils(this)

    }

    fun openCam(){
    }



    fun interface onPicResultListener {
        fun onResult(result: java.util.ArrayList<LocalMedia>)
    }

    override fun toString(): String {
        return "Computer(maxNum='$maxNum', minNum='$minNum', isDisplayCamera=$isDisplayCamera)"
    }
}