//
//  AppIdentifiers.swift
//  TheNoiseClock
//
//  Created by Matt Bruce on 1/31/26.
//

import Foundation

enum AppIdentifiers {
    static let appGroupIdentifier: String = {
        Bundle.main.object(forInfoDictionaryKey: "AppGroupIdentifier") as? String
            ?? "group.com.mbrucedogs.TheNoiseClock"
    }()

    static let cloudKitContainerIdentifier: String = {
        Bundle.main.object(forInfoDictionaryKey: "CloudKitContainerIdentifier") as? String
            ?? "iCloud.com.mbrucedogs.TheNoiseClock"
    }()

    static let appClipDomain: String = {
        Bundle.main.object(forInfoDictionaryKey: "AppClipDomain") as? String
            ?? "thenoiseclock.app"
    }()

    static var bundleIdentifier: String {
        Bundle.main.bundleIdentifier ?? "com.mbrucedogs.TheNoiseClock"
    }

    static var watchBundleIdentifier: String {
        "\(bundleIdentifier).watchkitapp"
    }

    static var appClipBundleIdentifier: String {
        "\(bundleIdentifier).Clip"
    }

    static var widgetBundleIdentifier: String {
        "\(bundleIdentifier).Widget"
    }

    static func appClipURL(recordName: String) -> URL? {
        URL(string: "https://\(appClipDomain)/appclip?id=\(recordName)")
    }
}
