export type CleanConfig = {
  strip_utms: boolean;
  fix_quotes: boolean;
  fix_newlines: boolean;
  play_sound: boolean;
  autostart: boolean;
  hotkey: string;
  custom_params: string[];
};

export type ActiveTab = "general" | "rules" | "license";

export type TabSpecificState =
  | { tab: "general"; isRecording: boolean }
  | { tab: "rules" }
  | { tab: "license"; keyInput: string; isActivating: boolean; error: string };

export type AppState = {
  config: CleanConfig;
  hotkeyConflict: boolean;
  hwid: string;
  isLicensed: boolean;
  tabState: TabSpecificState;
};

export type AppAction =
  | {
      type: "INITIALIZE";
      payload: {
        config: CleanConfig;
        hotkeyConflict: boolean;
        hwid: string;
        isLicensed: boolean;
      };
    }
  | { type: "SET_TAB"; payload: ActiveTab }
  | { type: "SET_CONFIG"; payload: Partial<CleanConfig> }
  | { type: "SET_RECORDING"; payload: boolean }
  | { type: "SET_LICENSE_KEY_INPUT"; payload: string }
  | { type: "START_ACTIVATION" }
  | { type: "ACTIVATION_SUCCESS" }
  | { type: "ACTIVATION_FAILURE"; payload: string }
  | { type: "SET_HOTKEY_CONFLICT"; payload: boolean };
