//
//  AccessibilityIdentifiers.swift
//  Reflect (iOS)
//
//  Centralized accessibility identifiers for XCUITest targeting.
//

import Foundation

enum AccessibilityID {
    // MARK: - Tabs
    enum Tab {
        static let day = "tab_day"
        static let month = "tab_month"
        static let year = "tab_year"
        static let insights = "tab_insights"
        static let settings = "tab_settings"
    }

    // MARK: - Mood Buttons (voting header)
    enum MoodButton {
        static let great = "mood_button_great"
        static let good = "mood_button_good"
        static let average = "mood_button_average"
        static let bad = "mood_button_bad"
        static let horrible = "mood_button_horrible"

        static func id(for moodStrValue: String) -> String {
            "mood_button_\(moodStrValue.lowercased())"
        }
    }

    // MARK: - Day View
    enum DayView {
        static let moodHeader = "mood_header"
        static let entryList = "entry_list"
        static let emptyState = "empty_state"
        static let emptyStateNoData = "empty_state_no_data"
        static func entryRow(dateString: String) -> String {
            "entry_row_\(dateString)"
        }
    }

    // MARK: - Entry Detail
    enum EntryDetail {
        static let sheet = "entry_detail_sheet"
        static let doneButton = "entry_detail_done"
        static let deleteButton = "entry_detail_delete"
        static let noteButton = "entry_detail_note_button"
        static let noteArea = "entry_detail_note_area"
        static let moodGrid = "entry_detail_mood_grid"
    }

    // MARK: - Note Editor
    enum NoteEditor {
        static let textEditor = "note_editor_text"
        static let saveButton = "note_editor_save"
        static let cancelButton = "note_editor_cancel"
    }

    // MARK: - Settings
    enum Settings {
        static let header = "settings_header"
        static let customizeTab = "settings_tab_customize"
        static let settingsTab = "settings_tab_settings"
        static let upgradeBanner = "upgrade_banner"
        static let subscribeButton = "subscribe_button"
        static let whyUpgradeButton = "why_upgrade_button"
        static let clearDataButton = "settings_clear_data"
        static let analyticsToggle = "settings_analytics_toggle"
        static let showOnboardingButton = "settings_show_onboarding"
        static let bypassSubscriptionToggle = "settings_bypass_subscription"
        static let eulaButton = "settings_eula"
        static let privacyPolicyButton = "settings_privacy_policy"
    }

    // MARK: - Customize
    enum Customize {
        static let themeSection = "customize_theme_section"
        static let browseThemesButton = "browse_themes_button"
        static let appThemePickerDoneButton = "apptheme_picker_done"
        static let appThemePreviewCancelButton = "apptheme_preview_cancel"
        static let appThemePreviewApplyButton = "apptheme_preview_apply"
        static func themeButton(_ name: String) -> String {
            "customize_theme_\(name.lowercased())"
        }
        static func votingLayoutButton(_ name: String) -> String {
            "customize_voting_\(name.lowercased())"
        }
        static func dayViewStyleButton(_ name: String) -> String {
            "customize_daystyle_\(name.lowercased())"
        }
        static func iconPackButton(_ name: String) -> String {
            "customize_iconpack_\(name.lowercased())"
        }
        static func personalityPackButton(_ name: String) -> String {
            "customize_personality_\(name.lowercased())"
        }
        static func appThemeCard(_ name: String) -> String {
            "apptheme_card_\(name.lowercased())"
        }
    }

    // MARK: - Paywall
    enum Paywall {
        static let monthOverlay = "paywall_month_overlay"
        static let yearOverlay = "paywall_year_overlay"
        static let insightsOverlay = "paywall_insights_overlay"
    }

    // MARK: - Day View Section Headers
    enum DaySection {
        static func header(month: Int, year: Int) -> String {
            "day_section_\(month)_\(year)"
        }
    }

    // MARK: - Insights
    enum Insights {
        static let header = "insights_header"
        static let monthSection = "insights_month_section"
        static let yearSection = "insights_year_section"
        static let allTimeSection = "insights_all_time_section"
    }

    // MARK: - Month View
    enum MonthView {
        static let grid = "month_grid"
        static let shareButton = "month_share_button"
    }

    // MARK: - Year View
    enum YearView {
        static let heatmap = "year_heatmap"
        static let donutChart = "year_donut_chart"
        static let barChart = "year_bar_chart"
        static let statsSection = "year_stats_section"
        static func cardHeader(year: Int) -> String { "year_card_header_\(year)" }
        static let shareButton = "year_share_button"
    }

    // MARK: - Onboarding
    enum Onboarding {
        static let container = "onboarding_container"
        static let welcomeScreen = "onboarding_welcome"
        static let timeScreen = "onboarding_time"
        static let dayScreen = "onboarding_day"
        static let dayToday = "onboarding_day_today"
        static let dayYesterday = "onboarding_day_yesterday"
        static let styleScreen = "onboarding_style"
        static let subscriptionScreen = "onboarding_subscription"
        static let subscribeButton = "onboarding_subscribe_button"
        static let skipButton = "onboarding_skip_button"
    }

    // MARK: - Common
    enum Common {
        static let lockScreen = "lock_screen"
        static let onboarding = "onboarding_sheet"
    }
}
