import RealFlags

public extension ParameterStores {
    struct Hooks: SunoStatsigParameterStore {
        public static let parameterStoreName: String = "ios-hooks"

        @Flag(key: "hooks-tab-bar", default: false, description: "Default-off flag as an off-switch to use the new Hooks tab bar or not")
        public var hooksTabBar: Bool

        @Flag(key: "hooks-in-library", default: false, description: "Default-off flag as an off-switch to show the updated Library covers with the new Hooks entry point or not")
        public var hooksInLibrary: Bool

        @Flag(key: "hooks-in-profile", default: false, description: "Default-off flag as an off-switch to show Hooks in Profiles")
        public var hooksInProfile: Bool

        @Flag(key: "hooks-in-omniplayer", default: false, description: "Default-off flag as an off-switch to show Hooks in OmniPlayer")
        public var hooksInOmniPlayer: Bool

        @Flag(key: "ios-hooks-deep-linking", default: false, description: "Default-off flag as an off-switch to allow deep-linking to hooks")
        public var hooksDeeplinkingEnabled: Bool

        @Flag(key: "feed_location", default: "disabled", description: "Default-off flag as an off-switch to show Hooks in the app")
        public var feedLocation: String

        @Flag(key: "feed_type", default: "fullscreen", description: "Default-off flag as an off-switch to show Hooks in the app")
        public var feedType: String

        @Flag(key: "create_hook_from_clip", default: false, description: "Default-off flag as an off-switch to allow Create Hook from Song Actions Menu")
        public var createHookFromClip: Bool

        @Flag(key: "allow-hook-download", default: false, description: "Default-off flag as an off-switch to allow anyone to download Hook from Hook and Song Actions Menu")
        public var allowAllHookDownloads: Bool

        @Flag(key: "allow-self-hook-download", default: false, description: "Default-off flag as an off-switch to allow creator to download Hook from Hook and Song Actions Menu")
        public var allowSelfHookDownload: Bool

        public init() {}

        // Separate function to explicitly mark once at initialization
        public static func markHooksExperimentExposure() {
            // Mark exposure for Hooks experiments:
            // - feedLocation: `disabled`, `first`, `second`
            // - feedType: `fullscreen`, `carousel`
            markExposed(flag: \.$feedLocation)
            markExposed(flag: \.$feedType)
        }

        public var isFeedEnabled: Bool {
            if feedLocation == "disabled" {
                return false
            } else {
                return true
            }
        }

        public var showOnFirstTab: Bool {
            if feedLocation == "first" {
                return true
            } else {
                return false
            }
        }

        public var showOnSecondTab: Bool {
            if feedLocation == "second" {
                return true
            } else {
                return false
            }
        }

        public var showCarousel: Bool {
            if feedType == "carousel" {
                return true
            } else {
                return false
            }
        }
    }
}
