import Foundation

// TODO: deprecate this in favor of FilePathKeys
public extension URL {
    // TODO: we should migrate this out of documents, and into application support. Documents is visible to the user
    static var savedPrompts = Self.documentsDirectory.appending(component: "saved-prompts.json")
}

// NOTE: never define a raw value, use the synthesized value to make collisions impossible
public enum FilePathKeys {
    public enum ApplicationSupport: String, FilePathKeyType {
        public static var baseURL: URL { URL.applicationSupportDirectory }

        case meOnLastAppSession
        // Blended Create
        case lastUsedBlendedCreatePrompt
        case lastUsedCreateTab // Useful while Scenes isn't on blended create yet
        case selectedLyricsModel
        case appSessionData // For app session count data, see AppSessionCountClient
    }

    public enum Caches: String {
        public static var baseURL: URL { URL.cachesDirectory }

        case nyi // leaving this in to show how to define paths
    }
}

public protocol FilePathKeyType {
    static var baseURL: URL { get }

    var rawValue: String { get }
}

public extension FilePathKeyType {
    func url() -> URL {
        Self.baseURL.appendingPathComponent(rawValue)
    }
}
