package com.zxhy.simplefilesmanager.simplejoke
import android.content.Context
import android.text.format.Formatter

data class Disk(
    val path: String = "", //路径
    val name: String = "", //名称
    val type: Int = 0,//类型 0U盘  1 data区域 2内置存储区域
    val total: Long = 0, //总计数量
    val used: Long = 0, //已用空间
    val free: Long = 0, //空闲空间
) {


    fun getTotalContent(context: Context): String {
        return Formatter.formatFileSize(context, total)
    }

    fun getUsedContent(context: Context): String {
        return Formatter.formatFileSize(context, used)
    }

    fun getFreeContent(context: Context): String {
        return Formatter.formatFileSize(context, free)
    }

    companion object {
        const val TYPE_U = 0 //u盘
        const val TYPE_DATA = 1 //data区域
        const val TYPE_EXTERNAL = 2 //外置存储
    }
}