package com.example.livingai.storage

import android.os.Environment
import java.io.File

object StorageUtils {
    
    private const val ROOT_FOLDER_NAME = "com.LivingAI"

    private fun getBaseFolder(): File {
        val folder = File(Environment.getExternalStorageDirectory(), "Android/media/$ROOT_FOLDER_NAME")
        if (!folder.exists()) {
            folder.mkdirs()
        }
        return folder
    }

    fun getDocumentsFolder(): File {
        val folder = File(getBaseFolder(), "Documents")
        if (!folder.exists()) {
            folder.mkdirs()
        }
        return folder
    }

    fun getImagesBaseFolder(): File {
        val folder = File(getBaseFolder(), "Images")
        if (!folder.exists()) {
            folder.mkdirs()
        }
        return folder
    }

    fun getCowImageFolder(cowId: String): File {
        return File(getImagesBaseFolder(), cowId)
    }

    fun getVideosFolder(): File {
        val folder = File(getBaseFolder(), "Videos")
        if (!folder.exists()) {
            folder.mkdirs()
        }
        return folder
    }
}
