/**
 * Event names for tracking user interactions.
 *
 * Name events using constants with `verbNoun` format.
 * Organize related events to the same feature or component together.
 *
 */
export const EventNames = {
  // ==============
  // Create song button events
  // --------------

  /**
   * Event for when an <OneboxCreate /> inspiration card is clicked.
   */
  clickedInspirationCard: 'Inspiration Card Clicked',

  // ==============
  // Create song button events
  // --------------

  /**
   * Event for when the user clicks the "Create Song" button.
   * @param {number} promptLength - The length of the song prompt.
   */
  clickedCreateSongLoggedOut: 'Logged out: Clicked Create Song',

  /**
   * Event for when the user clicks the "Create Song" button.
   * @param {number} descriptionLength - The length of the song prompt in simple mode.
   * @param {bool} instrumental        - Whether the song is instrumental.
   * @param {bool} isSimpleMode        - Whether the user is in simple mode.
   * @param {number} lyricsLength      - The length of the lyrics in custom mode.
   * @param {string} modelVersion      - The model version used to generate the song.
   * @param {number} styleLength       - The length of the style in custom mode.
   * @param {string} eventSource       - enum: mobile, topBar, createClient.
   */
  clickedCreateSong: 'Create Song Clicked',

  // ==============
  // Song Creation Response Events
  // --------------

  /**
   * Event for handling success for when song is requested.
   *
   * @param {string} modelVersion - The model version used to generate the song.
   */
  songCreateResponseSuccess: 'Song Successfully Created',

  /**
   * Event for handling error for when song is requested.
   *
   * @param {string} modelVersion - The model version used to generate the song.
   * @param {string} errorCode - The error code returned from the server.
   * @param {string} errorReason - The error reason returned from the server.
   */
  songCreateResponseError: 'Song Create Request Errored',

  // ==============
  // Playbar player events
  // --------------

  /**
   * Event for when the user clicks the play button while stream is loading.
   *
   * @param {boolean} isMobile           - The event is on mobile or not.
   * @param {boolean} hasClip            - Whether the player has a clip loaded.
   * @param {string} clipId              - The song Id.
   * @param {boolean} isPlaying          - Whether the player is currently playing.
   * @param {number} clipCount           - The number of clips in the library.
   * @param {number} playlistCount       - The number of playlists in the library.
   * @param {number} allPlaylistIdsCount - The IDs of all the playlists in the library.
   * @param {boolean} isUserSongOwner    - The song belongs to the user or not.
   */
  audioPlayerWhileLoadingPlayClicked:
    'Audio Player: While Loading Play Clicked',

  /**
   * Event for when the user create an audio, event list: create new, extend, reuse prompt, upload audio&create.
   *
   * @param {boolean} isMobile           - The event is on mobile or not.
   * @param {string} continueClipId      - The song Id of extend.
   * @param {string} reusePromptClipId   - The song Id reuse prompt.
   * @param {[string]} newClipIds        - The new song Ids.
   * @param {string} actionName          - The enum value of one PlayerEvents in playState.ts file
   * @param {string} clickSourceUrl      - The click is from which page.
   * @param {string} userId              - The user Id.
   * @param {boolean} isCustomMode       - Is custom mode on.
   * @param {boolean} hasLyrics          - Has lyrics or not.
   * @param {boolean} hasStyle           - Has style or not.
   * @param {boolean} hasTitle           - Has title or not.
   * @param {boolean} hasDescription     - Has description or not.
   * @param {boolean} isInstrumentalMode - Is intrumental mode on.
   * @param {boolean} isUploaded         - Is audio uploaded successful or not.
   * @param {string} uploadType          - Audio upload from mic or folders.
   * @param {string} modelVersion        - Model version.
   * @param {boolean} isUserSongOwner    - The song belongs to the user or not.
   * @param {string} recommendStyle      - The recommend style value.
   * @param {boolean} isRecommendStyleUsed - Is Recommend style used when create the song.
   * @param {boolean} isContinueClipPublic - Is the extend song public or private.
   * @param {boolean} isReusePromptClipPublic - Is the reuse prompt song public or private.
   * @param {string} errorMessage          - The error message when created song failed.
   * @param {boolean} hasVocal             - Is the upload audio or file uploaded contains vocal.
   * @param {string} uploadId              - The upload id.
   */
  audioCreationEvent: 'Audio-Creation-Event',

  /**
   * Event for when the user operate an audio, event list: like&dislike, share, add to playlist, download, report, go to song radio.
   *
   * @param {boolean} isMobile        - The event is on mobile or not.
   * @param {string} clipId           - The song Id.
   * @param {string} playlistId       - The ID of playlist.
   * @param {string} actionName       - The enum value of like/unlike/dislike, share, add to playlist, download, report, go to song radio.
   * @param {boolean} isUserSongOwner - The song belongs to the user or not.
   * @param {string} clickSourceUrl   - The click is from which page.
   * @param {string} userId           - The user Id.
   * @param {boolean} isPublic        - Is the song public or private.
   */
  audioActionEvent: 'Audio-Action-Event',

  /**
   * Event for playlist operations, event list: like/dislike playlist, share.
   *
   * @param {boolean} isMobile            - The event is on mobile or not.
   * @param {string} playlistId           - The ID of playlist.
   * @param {string} userId               - The user Id.
   * @param {string} actionName           - The action user click: like/unlike playlist, share.
   * @param {boolean} isUserPlaylistOwner - The playlist belongs to the user or not.
   * @param {string} clickSourceUrl       - The click is from which page.
   */
  playlistActionEvent: 'Playlist-Action-Event',

  /**
   * Event for artist related operations, event list: follow/unfollow artist.
   *
   * @param {boolean} isMobile      - The event is on mobile or not.
   * @param {string} userId         - The user Id.
   * @param {string} followeeId     - The followee user Id.
   * @param {string} actionName     - The action user click: follow/unfollow artist.
   * @param {string} clickSourceUrl - The click is from which page.
   */
  artistActionEvent: 'Artist-Action-Event',

  /**
   * Event for when the user clicks the audio player.
   *
   * @param {string} songSessionId       - The sessionId used to group a bunch of operations relates to one song.
   * @param {boolean} isMobile           - The event is on mobile or not.
   * @param {boolean} hasClip            - Whether the player has a song loaded.
   * @param {string} clipId              - The song Id.
   * @param {number} startTime           - The song play start time
   * @param {number} endTime             - The song play pause time
   * @param {number} playDuration        - The total time song played before next action
   * @param {number} totalDuration       - The total time song played in one songSessionId
   * @param {boolean} isPlaying          - Whether the player is currently playing.
   * @param {number} clipCount           - The order of clips in the library.
   * @param {number} totalClipsCount     - The total clips number in the playlist.
   * @param {number} playlistCount       - The number of playlists in the library.
   * @param {string} playlistId          - The ID of playlist.
   * @param {string} actionName          - The enum value of one PlayerEvents in playState.ts file
   * @param {boolean} isUserSongOwner    - The song belongs to the user or not.
   * @param {number} volume              - The volume of the song.
   * @param {string} clickSourceUrl      - The click is from which page.
   * @param {boolean} isAutoplayOn       - Is auto play on.
   * @param {boolean} isRepeatOn         - Is auto repeat on.
   * @param {string} userId              - The user Id.
   * @param {string} previousSongSessionId - The previous song session Id.
   * @param {string} actionIndex         - The index of the action.
   * @param {boolean} isPublic           - Is the song public or private.
   */
  audioPlayerEvent: 'Audio-Player-Event',

  /**
   * Event for when the user update his account info, login, logout and so on.
   */
  accountActionEvent: 'Account-Action-Event',

  /**
   * Event for when the user click any link in suno and case redirect like click help, about, careers and so on.
   * @param {string} url - link url.
   */
  linkClickEvent: 'Link-Click-Event',

  /**
   * Event for when the user search, like search by keyword, songs, playlists and so on.
   */
  searchEvent: 'Search-Event',

  /**
   * Event for audio event.
   */
  audioEditingEvent: 'Audio-Editing-Event',

  /**
   * Click Event for recommended styles.
   *
   * @param {boolean} isMobile - Is the click on mobile.
   * @param {string}  style    - The value of the recommended style.
   */
  recommendedStyleClick: 'Click Recommended Style',

  /**
   * Event for user search for public songs.
   * @param {string} query
   * @param {boolean} is_public
   * @param {number} from_index
   */
  songSearch: 'Search: search for songs',

  /**
   * Click Event for extend button.
   *
   * @param {boolean} isUserSongOwner - The song belongs to the user or not.
   * @param {string}  clipId          - The song ID.
   * @param {boolean} isMobile        - Is the event from mobile
   */
  extendSongBtnClick: 'Click Extend Button',

  /**
   * Click Event for like song button.
   *
   * @param {boolean} isUserSongOwner - The song belongs to the user or not.
   * @param {string}  clipId          - The song ID .
   * @param {boolean} isLike          - Is the action like or revoke like
   * @param {boolean} isMobile        - Is the event from mobile
   */
  likeSongBtnClick: 'Click Like Song Button',

  /**
   * Click Event for like Autoplay button.
   *
   * @param {boolean} isAutoPlayOn    - Is the auto play turn on or off
   * @param {boolean} isMobile        - The event is on Mobile or not.
   */
  autoPlayBtnClick: 'Click AutoPlay Button',

  /**
   * Click Event for Reuse Prompt button.
   *
   * @param {boolean} isUserSongOwner - The song belongs to the user or not.
   * @param {string}  clipId          - The song ID.
   * @param {boolean} isMobile        - The event is on Mobile or not.
   */
  reusePromptBtnClick: 'Click Reuse Prompt Button',

  /**
   * Click Event for Cover Song button.
   *
   * @param {boolean} isUserSongOwner - The song belongs to the user or not.
   * @param {string}  clipId          - The song ID.
   * @param {boolean} isMobile        - The event is on Mobile or not.
   */
  coverSongBtnClick: 'Click Cover Song Button',
  /**
   * Click Event for Copy Link button.
   *
   * @param {boolean} isUserSongOwner - The song belongs to the user or not.
   * @param {string}  clipId          - The song ID.
   * @param {boolean} isMobile        - The event is on Mobile or not.
   */
  copyLinkBtnClick: 'Click Copy Link Button',

  /**
   * Click Event for Share to... button.
   *
   * @param {boolean} isUserSongOwner - The song belongs to the user or not.
   * @param {string}  clipId          - The song ID.
   * @param {boolean} isMobile        - The event is on Mobile or not.
   */
  shareToBtnClick: 'Click Share to Button',

  /**
   * Click Event for Share on Facebook button.
   *
   * @param {boolean} isUserSongOwner - The song belongs to the user or not.
   * @param {string}  clipId          - The song ID.
   * @param {boolean} isMobile        - The event is on Mobile or not.
   */
  shareOnFackbookClick: 'Click Share On Facebook Button',

  /**
   * Click Event for Share on LinkedIn button.
   *
   * @param {boolean} isUserSongOwner - The song belongs to the user or not.
   * @param {string}  clipId          - The song ID.
   * @param {boolean} isMobile        - The event is on Mobile or not.
   */
  shareOnLinkedInClick: 'Click Share On LinkedIn Button',

  /**
   * Click Event for Share on Reddit button.
   *
   * @param {boolean} isUserSongOwner - The song belongs to the user or not.
   * @param {string}  clipId          - The song ID.
   * @param {boolean} isMobile        - The event is on Mobile or not.
   */
  shareOnRedditClick: 'Click Share On Reddit Button',

  /**
   * Click Event for Share on X button.
   *
   * @param {boolean} isUserSongOwner - The song belongs to the user or not.
   * @param {string}  clipId          - The song ID.
   * @param {boolean} isMobile        - The event is on Mobile or not.
   */
  shareOnXClick: 'Click Share On X Button',

  /**
   * Click Event for Share on Email button.
   *
   * @param {boolean} isUserSongOwner - The song belongs to the user or not.
   * @param {string}  clipId          - The song ID.
   * @param {boolean} isMobile        - The event is on Mobile or not.
   */
  shareOnEmailClick: 'Click Share On Email Button',

  /**
   * Click Event for Follow button.
   *
   * @param {string} followerId - The userId beening followed.
   * @param {boolean} isFollow  - Is the click follow or unfollow.
   * @param {boolean} isMobile  - The event is on Mobile or not.
   */
  followBtnClick: 'Click Follow Button',

  /**
   * Click Event for Open Playlist Page.
   *
   * @param {string} playlistId - The id of a playlist.
   * @param {boolean} isMobile  - The event is on Mobile or not.
   */
  playlistPageOpen: 'Open Playlsit Page',

  /**
   * Audio upload banner
   *
   */
  audioUploadBanner: 'AudioUploadBanner',

  /**
   * Event for tracking social media icon click.
   * tutorial click event
   *
   */
  tutorialClick: 'Creation Music Creation Tutorial',

  /**
   * Click Event for exclude styles.
   *
   * @param {boolean} isMobile  - Is the click on mobile.
   * @param {string} userId     - The user Id.
   * @param {boolean} isChecked - Is the exclude style checked or not.
   */
  excludeStyleClick: 'Click Exclude Style',

  /**
   * web page event.
   *
   * @param {string} userId     - The user Id.
   * @param {string} eventType  - The event name. scroll, click, play, pause, etc.
   * @param {string} pageUrl    - The page url.
   * @param {string} element    - The action element name.
   * @param {number} elementIndex    - The action element index.
   * @param {string} secondaryElement  - The action secondary element name.
   * @param {number} secondaryElementIndex  - The action element idx.
   * @param {string} entityId   - Entity id.
   * @param {string} entityType - Entity type.
   * @param {string} method - How you are sharing this event. link, via X, etc.
   */
  webPageEvent: 'Web-Page-Event',

  /**
   * Web User Event: new event for tracking user actions on web pages
   * for more info see https://docs.google.com/document/d/1-h97sUNQDOMJFyQUjRy5EeCSWXKt7xZaLqd6sAUbqJk/edit?tab=t.8hwhawiz5dvt#heading=h.ewzwpeyz2roa
   *
   * @param {string} userId
   * @param {string} sessionId - the global session Id.
   * @param {string} featureSessionType - the session type for a feature (eg. create, edit).
   * @param {string} featureSessionId - the scoped session Id for a feature.
   * @param {string} componentContext - the component context that the action occured in
   * @param {string} actionName
   * @param {string} objectValue - the value of the relevant object
   * @param {string} objectType - the type of the relevant object
   * @param {object} context - any additional context for the event
   */
  webUserEvent: 'Web-User-Event' as const,
};

/**
 * Records all the action names collected in logging system.
 */
export const ActionName = {
  /* audioPlayerEvent actions enum */
  identify: 'Identify',
  playNewSong: 'PlayNewSong',
  songEnd: 'SongEnd',
  autoRepeatPlaySong: 'AutoRepeatPlaySong',
  playSong: 'PlaySong',
  pauseSong: 'PauseSong',
  seekProgressBarPauseSong: 'SeekProgressBarPauseSong',
  seekProgressBarPlaySong: 'SeekProgressBarPlaySong',
  backwardPauseSong: 'BackwardPauseSong',
  backwardRepeatSong: 'BackwardRepeatSong',
  forwardPausePreSong: 'ForwardPausePreSong',
  playNewSongPauseSong: 'PlayNewSongPauseSong',
  autoPlayNewSong: 'AutoPlayNewSong',
  autoRepeatPauseSong: 'AutoRepeatPauseSong',
  backwardPlayNewSong: 'BackwardPlayNewSong',
  forwardPlayNewSong: 'ForwardPlayNewSong',
  playSongInMediaSession: 'PlaySongInMediaSession',
  seekProgressBarPlaySongInMediaSession:
    'SeekProgressBarPlaySongInMediaSession',
  seekProgressBarPauseSongInMediaSession:
    'SeekProgressBarPauseSongInMediaSession',

  /* audioCreationEvent actions enum */
  createSong: 'CreateSong',
  uploadSong: 'UploadSong',
  useRecommendStyle: 'UseRecommendStyle',
  clickDisabledCreateSongWhenOutOfCredits:
    'ClickDisabledCreateSongWhenOutOfCredits',
  redirectToAccountPage: 'RedirectToAccountPage',

  /* audioActionEvent actions enum */
  likeSong: 'LikeSong',
  undoLikeSong: 'UndoLikeSong',
  dislikeSong: 'DislikeSong',
  undoDislikeSong: 'UndoDislikeSong',

  makePublic: 'MakePublic',
  makePrivate: 'MakePrivate',

  shareSongWithLink: 'ShareSongWithLink',
  shareSongWithX: 'ShareSongWithX',
  shareSongWithFacebook: 'ShareSongWithFacebook',
  shareSongWithEmail: 'ShareSongWithEmail',
  shareSongWithLinkedIn: 'ShareSongWithLinkedIn',
  shareSongWithReddit: 'ShareSongWithReddit',
  shareSongWithInApp: 'ShareSongWithInApp',

  downloadMP3: 'DownloadMP3',
  downloadWAV: 'DownloadWAV',
  downloadWAVUrlRetrieved: 'DownloadWAVUrlRetrieved',
  downloadWAVTimeout: 'DownloadWAVTimeout',
  downloadVideo: 'DownloadVideo',

  regenerateVideo: 'RegenerateVideo',

  getStems: 'GetStems',
  clickDisabledGetStems: 'ClickDisabledGetStems',

  upsampleClip: 'UpsampleClip',
  clickDisabledUpsample: 'ClickDisabledUpsample',

  reportInappropriate: 'ReportInappropriate',
  goToSongRadio: 'GoToSongRadio',

  editTitle: 'EditTitle',
  editLyrics: 'EditLyrics',

  reusePrompt: 'ReusePrompt',
  coverSong: 'CoverSong',
  extendSong: 'ExtendSong',
  clickDisabledCoverSong: 'ClickDisabledCoverSong',

  /* playlistActionEvent actions enum */
  likePlaylist: 'LikePlaylist',
  undoLikePlaylist: 'UndoLikePlaylist',
  dislikePlaylist: 'DislikePlaylist',
  undoDislikePlaylist: 'UndoDislikePlaylist',
  sharePlaylistWithLink: 'sharePlaylistWithLink',

  /* artistActionEvent actions enum */
  followArtist: 'FollowArtist',
  unfollowArtist: 'UnfollowArtist',
  shareArtistWithLink: 'ShareArtistWithLink',

  /* editModeActionEvent actions enum */
  cancelConfirmLyricsReplacement: 'CancelConfirmLyricsReplacement',
  confirmLyricsReplacement: 'ConfirmLyricsReplacement',
  confirmWaveformSelection: 'ConfirmWaveformSelection',
  endEditModeSession: 'EndEditModeSession',
  exitEditMode: 'ExitEditMode',
  makeWaveformSelection: 'MakeWaveformSelection',
  resetWaveformSelection: 'ResetWaveformSelection',
  selectEditModeTool: 'SelectEditModeTool',
  selectGeneratedClipForConcat: 'SelectGeneratedClipForConcat',
  setClipMetadataEditMode: 'SetClipMetadataEditMode',
  startEditModeSession: 'StartEditModeSession',
  startLyricsReplacement: 'StartLyricsReplacement',
  submitEditModeGenerateAction: 'SubmitEditModeGenerateAction',
  updateLyricsReplacement: 'UpdateLyricsReplacement',
  updateDurationControl: 'UpdateDurationControl',

  /* negativeTags */
  enableNegativeTags: 'EnableNegativeTags',
  disableNegativeTags: 'DisableNegativeTags',
  clickDisabledNegativeTags: 'ClickDisabledNegativeTags',
};

export const ComponentContext = {
  SONG_ACTIONS: 'song_actions',
  MOBILE_SONG_ACTIONS: 'mobile_song_actions',
  SONG_DROPDOWN: 'song_dropdown',
  SONG_CARD: 'song_card',
};
