package com.pixelized.shared.lwa.utils

class PathProvider(
    private val operatingSystem: OperatingSystem = OperatingSystem.current,
    private val appName: String,
) {
    fun storePath(
        os: OperatingSystem = this.operatingSystem,
        app: String = this.appName,
    ): String {
        return when (os) {
            OperatingSystem.Windows -> "${os.home}\\AppData\\Roaming\\Pixelized\\$app\\"
            OperatingSystem.Macintosh -> "${os.home}/Library/Pixelized/$app/"
        }
    }

    fun resourcesPath(
        os: OperatingSystem = this.operatingSystem,
        app: String = this.appName,
    ): String {
        return when (os) {
            OperatingSystem.Windows -> "${storePath(os = os, app = app)}resources\\"
            OperatingSystem.Macintosh -> "${storePath(os = os, app = app)}resources/"
        }
    }

    fun imagesStorePath(
        os: OperatingSystem = this.operatingSystem,
        app: String = this.appName,
    ): String {
        return when (os) {
            OperatingSystem.Windows -> "${storePath(os = os, app = app)}_images\\"
            OperatingSystem.Macintosh -> "${storePath(os = os, app = app)}_images/"
        }
    }

    fun characterStorePath(
        os: OperatingSystem = this.operatingSystem,
        app: String = this.appName,
    ): String {
        return when (os) {
            OperatingSystem.Windows -> "${storePath(os = os, app = app)}characters\\"
            OperatingSystem.Macintosh -> "${storePath(os = os, app = app)}characters/"
        }
    }

    fun campaignPath(
        os: OperatingSystem = this.operatingSystem,
        app: String = this.appName,
    ): String {
        return when (os) {
            OperatingSystem.Windows -> "${storePath(os = os, app = app)}campaign\\"
            OperatingSystem.Macintosh -> "${storePath(os = os, app = app)}campaign/"
        }
    }

    fun alterationsPath(
        os: OperatingSystem = this.operatingSystem,
        app: String = this.appName,
    ): String {
        return when (os) {
            OperatingSystem.Windows -> "${storePath(os = os, app = app)}alterations\\"
            OperatingSystem.Macintosh -> "${storePath(os = os, app = app)}alterations/"
        }
    }

    fun itemsPath(
        os: OperatingSystem = this.operatingSystem,
        app: String = this.appName,
    ): String {
        return when (os) {
            OperatingSystem.Windows -> "${storePath(os = os, app = app)}items\\"
            OperatingSystem.Macintosh -> "${storePath(os = os, app = app)}items/"
        }
    }

    fun tagsPath(
        os: OperatingSystem = this.operatingSystem,
        app: String = this.appName,
    ): String {
        return when (os) {
            OperatingSystem.Windows -> "${storePath(os = os, app = app)}tags\\"
            OperatingSystem.Macintosh -> "${storePath(os = os, app = app)}tags/"
        }
    }

    fun inventoryPath(
        os: OperatingSystem = this.operatingSystem,
        app: String = this.appName,
    ): String {
        return when (os) {
            OperatingSystem.Windows -> "${storePath(os = os, app = app)}inventory\\"
            OperatingSystem.Macintosh -> "${storePath(os = os, app = app)}inventory/"
        }
    }

    fun mapPath(
        os: OperatingSystem = this.operatingSystem,
        app: String = this.appName,
    ): String {
        return when (os) {
            OperatingSystem.Windows -> "${storePath(os = os, app = app)}maps\\"
            OperatingSystem.Macintosh -> "${storePath(os = os, app = app)}maps/"
        }
    }
}
