package com.adealink.weparty.imageselect.model

enum class MediaType(val type: Int) {
    ALL(0), //全部
    IMAGE(1), //图片
    VIDEO(2); //视频

    companion object {

        fun getMediaType(type: Int): MediaType {
            return when (type) {
                IMAGE.type -> IMAGE
                VIDEO.type -> VIDEO
                else -> ALL
            }
        }

        fun getMediaType(mime: String?): MediaType {
            if (mime == null) {
                return ALL
            }

            return when {
                mime.startsWith("image/") -> IMAGE
                mime.startsWith("video/") -> VIDEO
                else -> ALL
            }
        }

    }

}

const val MESSAGE_GIF_MAX_SIZE_KB = 5 * 1024 * 1024 //GIF 图片上传最大size

data class LoadMediaConfig(
    val mediaType: MediaType,
    val filterGift: Boolean = true,
    val giftSizeLimit: Int = MESSAGE_GIF_MAX_SIZE_KB,
    val selectedMediaList: ArrayList<LocalMedia>? = null,
)

const val MEDIA_TYPE_IMAGE = "image/*"
const val MEDIA_TYPE_VIDEO = "video/*"