import axios from "axios";
import { THAT_UNNAMED_PERSON } from "./entities";

// Notification message constants for user-facing notifications
// Add new notification messages here as needed
//
// DOCUMENTATION FORMAT:
// Each constant is documented with a comment showing where it's used:
// "Used in: ComponentName.vue (method - specific usage description)"
// This helps maintain consistency and track usage across the codebase.
//
// Functions are documented with the specific component methods that call them.
// Constants marked with "[Component usage not yet documented]" need their
// usage locations verified and documented.

// Used in: [Component usage not yet documented]
export const NOTIFY_PERSON_HIDDEN = {
  title: "Person Outside Your Network",
  message: "This person is not visible to you.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_UNKNOWN_PERSON = {
  title: "Unidentified Person",
  message: "Nobody specific was recognized.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_CONTACT_LOADING_ISSUE = {
  title: "Contact Loading Issue",
  message: "Some contact information may be unavailable.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_FEED_LOADING_ISSUE = {
  title: "Feed Loading Issue",
  message: "Some feed data may be unavailable. Pull to refresh.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_CONFIRMATION_ERROR = {
  title: "Error",
  message: "There was a problem submitting the confirmation.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_CONTACT_DELETED = {
  title: "Deleted",
  message: "Contact has been removed.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_CONTACT_DELETE_FAILED = {
  title: "Error",
  message: "Failed to delete contact.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_REGISTRATION_SUCCESS = {
  title: "Registration Success",
  message: "has been registered.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_REGISTRATION_ERROR = {
  title: "Registration Error",
  message: "Something went wrong during registration.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_SERVER_ACCESS_ERROR = {
  title: "Error",
  message: "There was a problem accessing the server. Try again later.",
};

// Used in: endorserServer.ts (getHeaders function - personal data error)
export const NOTIFY_PERSONAL_DATA_ERROR = {
  title: "Personal Data Error",
  message:
    "Showing anonymous data. See the Help page for help with personal data.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_NO_IDENTITY_ERROR = {
  title: "No Identity",
  message: "There is no identity to use to check visibility.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_VISIBILITY_SET = {
  title: "Visibility Set",
  message: "visibility updated.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_VISIBILITY_REFRESHED = {
  title: "Visibility Refreshed",
  message: "visibility status updated.",
};

// QuickActionBvcEndView.vue specific constants
// Used in: QuickActionBvcEndView.vue (created method - error retrieving claims)
export const NOTIFY_ERROR_RETRIEVING_CLAIMS = {
  title: "Error",
  message: "There was an error retrieving today's claims to confirm.",
};

// Used in: QuickActionBvcEndView.vue (record method - sending status)
export const NOTIFY_SENDING_STATUS = {
  title: "Sent...",
  message: "",
};

// Used in: QuickActionBvcEndView.vue (record method - confirmation error)
export const NOTIFY_CONFIRMATION_SEND_ERROR = {
  title: "Error",
  message: "There was an error sending some of the confirmations.",
};

// Used in: QuickActionBvcEndView.vue (record method - all confirmations error)
export const NOTIFY_ALL_CONFIRMATIONS_ERROR = {
  title: "Error",
  message: "There was an error sending all of the confirmations.",
};

// Used in: QuickActionBvcEndView.vue (record method - give error)
export const NOTIFY_GIVE_SEND_ERROR = {
  title: "Error",
  message: "There was an error sending that give.",
};

// Used in: QuickActionBvcEndView.vue (record method - claims send error)
export const NOTIFY_CLAIMS_SEND_ERROR = {
  title: "Error",
  message: "There was an error sending claims.",
};

// Used in: QuickActionBvcEndView.vue (record method - single confirmation success)
export const NOTIFY_SINGLE_CONFIRMATION_SUCCESS = {
  title: "Success",
  message: "Your confirmation has been recorded.",
};

// Used in: QuickActionBvcEndView.vue (record method - multiple confirmations success)
export const NOTIFY_MULTIPLE_CONFIRMATIONS_SUCCESS = {
  title: "Success",
  message: "Your confirmations have been recorded.",
};

// Used in: QuickActionBvcEndView.vue (record method - give success)
export const NOTIFY_GIVE_SUCCESS = {
  title: "Success",
  message: "That give has been recorded.",
};

// Used in: QuickActionBvcEndView.vue (record method - confirmations and give success)
export const NOTIFY_CONFIRMATIONS_AND_GIVE_SUCCESS = {
  title: "Success",
  message: "Your confirmations and that give have been recorded.",
};

// Used in: QuickActionBvcEndView.vue (record method - confirmations only success)
export const NOTIFY_CONFIRMATIONS_ONLY_SUCCESS = {
  title: "Success",
  message: "Your confirmations have been recorded.",
};

// QuickActionBvcBeginView.vue specific constants
// Used in: QuickActionBvcBeginView.vue (record method - processing status)
export const NOTIFY_BVC_PROCESSING = {
  title: "Sent...",
  message: "",
};

// Used in: QuickActionBvcBeginView.vue (record method - time submission error)
export const NOTIFY_BVC_TIME_ERROR = {
  title: "Error",
  message: "There was an error sending the time.",
};

// Used in: QuickActionBvcBeginView.vue (record method - attendance submission error)
export const NOTIFY_BVC_ATTENDANCE_ERROR = {
  title: "Error",
  message: "There was an error sending the attendance.",
};

// Used in: QuickActionBvcBeginView.vue (record method - general submission error)
export const NOTIFY_BVC_SUBMISSION_ERROR = {
  title: "Error",
  message: "There was an error sending the claims.",
};

// Helper function for dynamic BVC success messages
// Used in: QuickActionBvcBeginView.vue (record method - dynamic success message)
export function createBvcSuccessMessage(
  timeSuccess: boolean,
  attendedSuccess: boolean,
): string {
  if (timeSuccess && attendedSuccess) {
    return "Your attendance and time have been recorded.";
  } else if (timeSuccess) {
    return "Your time has been recorded.";
  } else {
    return "Your attendance has been recorded.";
  }
}

// InviteOneAcceptView.vue specific constants
// Used in: InviteOneAcceptView.vue (handleMissingJwt method - missing invite error)
export const NOTIFY_INVITE_MISSING = {
  title: "Missing Invite",
  message: "There was no invite. Paste the entire text that has the data.",
};

// Used in: InviteOneAcceptView.vue (handleError method - invite processing error)
export const NOTIFY_INVITE_PROCESSING_ERROR = {
  title: "Error",
  message: "There was an error processing that invite.",
};

// Used in: InviteOneAcceptView.vue (checkInvite method - truncated invite data error)
export const NOTIFY_INVITE_TRUNCATED_DATA = {
  title: "Error",
  message:
    "That is only part of the invite data; it's missing some at the end. Try another way to get the full data.",
};

// ClaimReportCertificateView.vue specific constants
// Used in: ClaimReportCertificateView.vue (fetchClaim method - error loading claim)
export const NOTIFY_ERROR_LOADING_CLAIM = {
  title: "Error",
  message: "There was a problem loading the claim.",
};

// ContactsView.vue specific constants
// Used in: ContactsView.vue (processInviteJwt method - blank invite error)
export const NOTIFY_BLANK_INVITE = {
  title: "Blank Invite",
  message:
    "The invite was not included, which can happen when your iOS device cuts off the link. Try pasting the full link into a browser.",
};

// Used in: ContactsView.vue (processInviteJwt method - registration success)
export const NOTIFY_INVITE_REGISTRATION_SUCCESS = {
  title: "Registered",
  message: "You are now registered.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_INVITE_ERROR = {
  title: "Error with Invite",
  message: "Got an error sending the invite.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_ONBOARDING_CONFIRM = {
  title: "They're Added To Your List",
  message: "Would you like to go to the main page now?",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_REGISTER_NOT_AVAILABLE = {
  title: "Not Registered",
  message: "You must get registered before you can create invites.",
};

// SeedBackupView.vue specific constants
// Used in: SeedBackupView.vue (created method - error loading profile/seed data)
export const NOTIFY_PROFILE_SEED_LOAD_ERROR = {
  title: "Error Loading Profile",
  message: "Got an error loading your seed data.",
};

// OfferDetailsView.vue specific constants
// Used in: OfferDetailsView.vue (mounted method - error loading offer details)
export const NOTIFY_OFFER_ERROR_LOADING = {
  title: "Error",
  message: "There was an error loading the offer details.",
};

// Used in: OfferDetailsView.vue (loadPreviousOffer method - previous record error)
export const NOTIFY_OFFER_ERROR_PREVIOUS_RECORD = {
  title: "Retrieval Error",
  message:
    "The previous record isn't available for editing. If you submit, you'll create a new record.",
};

// Used in: OfferDetailsView.vue (confirm method - no identifier error)
export const NOTIFY_OFFER_ERROR_NO_IDENTIFIER = {
  title: "Error",
  message: "You must select an identifier before you can record a offer.",
};

// Used in: OfferDetailsView.vue (confirm method - negative amount error)
export const NOTIFY_OFFER_ERROR_NEGATIVE_AMOUNT = {
  title: "",
  message: "You may not send a negative number.",
};

// Used in: OfferDetailsView.vue (confirm method - no description error)
export const NOTIFY_OFFER_ERROR_NO_DESCRIPTION = {
  title: "Error",
  message: "You must enter a description or some number of {unit}.",
};

// Used in: OfferDetailsView.vue (confirm method - processing status)
export const NOTIFY_OFFER_PROCESSING = {
  title: "",
  message: "Recording the offer...",
};

// Used in: OfferDetailsView.vue (notifyUserOfProject method - no project error)
export const NOTIFY_OFFER_ERROR_PROJECT_ASSIGNMENT = {
  title: "Error",
  message: "To assign to a project, you must open this page through a project.",
};

// Used in: OfferDetailsView.vue (notifyUserOfProject method - conflict error)
export const NOTIFY_OFFER_ERROR_PROJECT_RECIPIENT_CONFLICT = {
  title: "Error",
  message: "You cannot assign both to a project and to a recipient.",
};

// Used in: OfferDetailsView.vue (notifyUserOfRecipient method - no recipient error)
export const NOTIFY_OFFER_ERROR_RECIPIENT_ASSIGNMENT = {
  title: "Error",
  message: "To assign to a recipient, you must open this page from a contact.",
};

// Used in: OfferDetailsView.vue (notifyUserOfRecipient method - conflict error)
export const NOTIFY_OFFER_ERROR_RECIPIENT_PROJECT_CONFLICT = {
  title: "Error",
  message: "You cannot assign both to a recipient and to a project.",
};

// Used in: OfferDetailsView.vue (recordOffer method - creation error)
export const NOTIFY_OFFER_ERROR_CREATION = {
  title: "Error",
  message: "There was an error creating the offer.",
};

// Used in: OfferDetailsView.vue (recordOffer method - success)
export const NOTIFY_OFFER_SUCCESS_RECORDED = {
  title: "Success",
  message: "That offer was recorded.",
};

// Used in: OfferDetailsView.vue (recordOffer method - recordation error)
export const NOTIFY_OFFER_ERROR_RECORDATION = {
  title: "Error",
  message: "There was an error recording the offer.",
};

// Used in: OfferDetailsView.vue (explainData method - privacy info)
export const NOTIFY_OFFER_PRIVACY_INFO = {
  title: "Data Sharing",
  message: "Your data is shared with the world when you sign and send.",
};

// ConfirmGiftView.vue specific constants
// Used in: ConfirmGiftView.vue (mounted method - error loading gift details)
export const NOTIFY_GIFT_ERROR_LOADING = {
  title: "Error",
  message: "There was an error loading the gift details.",
};

// Used in: ConfirmGiftView.vue (confirm method - no identifier error)
export const NOTIFY_GIFT_ERROR_NO_IDENTIFIER = {
  title: "Error",
  message: "You must select an identifier before you can record a gift.",
};

// Used in: ConfirmGiftView.vue (confirm method - negative amount error)
export const NOTIFY_GIFT_ERROR_NEGATIVE_AMOUNT = {
  title: "",
  message: "You may not send a negative number.",
};

// Used in: ConfirmGiftView.vue (confirm method - no description error)
export const NOTIFY_GIFT_ERROR_NO_DESCRIPTION = {
  title: "Error",
  message: "You must enter a description or some number of {unit}.",
};

// Used in: ConfirmGiftView.vue (confirm method - processing status)
export const NOTIFY_GIFT_PROCESSING = {
  title: "",
  message: "Recording the gift...",
};

// Used in: ConfirmGiftView.vue (recordGift method - creation error)
export const NOTIFY_GIFT_ERROR_CREATION = {
  title: "Error",
  message: "There was an error creating the gift.",
};

// Used in: ConfirmGiftView.vue (recordGift method - success)
export const NOTIFY_GIFT_SUCCESS_RECORDED = {
  title: "Success",
  message: "That gift was recorded.",
};

// Used in: ConfirmGiftView.vue (recordGift method - recordation error)
export const NOTIFY_GIFT_ERROR_RECORDATION = {
  title: "Error",
  message: "There was an error recording the gift.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_REGISTER_PROCESSING = {
  title: "Processing",
  message: "Sent...",
};

// Used in: getRegisterPersonSuccessMessage function
export const NOTIFY_REGISTER_PERSON_SUCCESS = {
  title: "Registration Success",
  message: "has been registered.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_REGISTER_PERSON_ERROR = {
  title: "Registration Error",
  message: "Something went wrong during registration.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_VISIBILITY_ERROR = {
  title: "Error Setting Visibility",
  message: "Could not set visibility on the server.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_UNCONFIRMED_HOURS = {
  title: "Unconfirmed Hours",
  message: "Would you like to confirm some of those hours?",
};

// Dynamic message template for unconfirmed hours (used in ContactsView.vue)
export const NOTIFY_UNCONFIRMED_HOURS_DYNAMIC = {
  title: "Unconfirmed Hours",
  // Template: "There {is/are} {count} unconfirmed {hour/hours} from them. Would you like to confirm some of those hours?"
  getMessage: (count: number): string => {
    const isAre = count === 1 ? "is" : "are";
    const hours = count === 1 ? "hour" : "hours";
    return `There ${isAre} ${count} unconfirmed ${hours} from them. Would you like to confirm some of those hours?`;
  },
};

// Complex modal constants (for raw $notify calls with advanced features)
// MembersList.vue complex modals
// Used in: MembersList.vue (complex modal for adding contacts)
export const NOTIFY_ADD_CONTACT_FIRST = {
  title: "Add as Contact First?",
  text: "This person is not in your contacts. Would you like to add them as a contact first?",
  yesText: "Add as Contact",
  noText: "Skip Adding Contact",
};

// Used in: MembersList.vue (complex modal for continuing without adding)
export const NOTIFY_CONTINUE_WITHOUT_ADDING = {
  title: "Continue Without Adding?",
  text: "Are you sure you want to proceed with admission? If they are not a contact, you will not know their name after this meeting.",
  yesText: "Yes, Continue",
  noText: "No, Cancel",
};

// HelpNotificationsView.vue specific constants
// Used in: HelpNotificationsView.vue (sendTestWebPushMessage method - not subscribed error)
export const NOTIFY_PUSH_NOT_SUBSCRIBED = {
  title: "Not Subscribed",
  message: "You must enable notifications before testing the web push.",
};

// Used in: HelpNotificationsView.vue (sendTestWebPushMessage method - success)
export const NOTIFY_TEST_WEB_PUSH_SUCCESS = {
  title: "Test Web Push Sent",
  message: "Check your device for the test web push message",
};

// Used in: HelpNotificationsView.vue (sendTestWebPushMessage method - error)
export const NOTIFY_TEST_WEB_PUSH_ERROR = {
  title: "Error Sending Test",
  message: "Got an error sending the test web push notification.",
};

// Used in: HelpNotificationsView.vue (showTestNotification method - success)
export const NOTIFY_TEST_NOTIFICATION_SUCCESS = {
  title: "Sent",
  message:
    "A notification was triggered, so one should show on your device entitled '{title}'.",
};

// Used in: HelpNotificationsView.vue (showTestNotification method - error)
export const NOTIFY_TEST_NOTIFICATION_ERROR = {
  title: "Failed",
  message: "Got an error sending a notification.",
};

// ContactsView.vue complex modals
// Used in: ContactsView.vue (addContact method - complex modal for registration)
export const NOTIFY_REGISTER_CONTACT = {
  title: "Register",
  text: "Do you want to register them?",
};

// TestView.vue specific constants
// Used in: TestView.vue (executeSql method - SQL error handling)
export const NOTIFY_SQL_ERROR = {
  title: "SQL Error",
  message: "Database operation failed.",
};

// Used in: TestView.vue (register method - complex modal for name requirement)
export const NOTIFY_PASSKEY_NAME_REQUIRED = {
  title: "No Name",
  text: "You should have a name to attach to this passkey. Would you like to enter your own name first?",
  noText: "try again and use",
};

// IdentitySwitcherView.vue specific constants
// Used in: IdentitySwitcherView.vue (created method - error loading accounts)
export const NOTIFY_ERROR_LOADING_ACCOUNTS = {
  title: "Error Loading Accounts",
  message: "Clear your cache and start over (after data backup).",
};

// Used in: IdentitySwitcherView.vue (notifyCannotDelete method - warning for active identity)
export const NOTIFY_CANNOT_DELETE_ACTIVE_IDENTITY = {
  title: "Cannot Delete",
  message:
    "You cannot delete the active identity. Set to another identity or 'no identity' first.",
};

// Used in: IdentitySwitcherView.vue (deleteAccount method - complex modal for delete confirmation)
export const NOTIFY_DELETE_IDENTITY_CONFIRM = {
  title: "Delete Identity?",
  text: "Are you sure you want to erase this identity? (There is no undo. You may want to select it and back it up just in case.)",
};

// ProjectViewView.vue complex modals
// Used in: ProjectViewView.vue (complex modal for claim confirmation)
export const NOTIFY_CONFIRM_CLAIM = {
  title: "Confirm",
  text: "Do you personally confirm that this is true?",
};

// UserProfileView.vue constants
// Used in: UserProfileView.vue (profile loading error)
export const NOTIFY_PROFILE_LOAD_ERROR = {
  title: "Profile Load Error",
  message: "There was a problem loading the profile.",
};

// ProjectsView.vue constants
// Used in: ProjectsView.vue (no account error)
export const NOTIFY_NO_ACCOUNT_ERROR = {
  title: "No Account Found",
  message: "You need an identifier to load your projects.",
};

// Used in: ProjectsView.vue (project load error)
export const NOTIFY_PROJECT_LOAD_ERROR = {
  title: "Project Load Error",
  message: "Failed to get projects from the server.",
};

// Used in: ProjectsView.vue (project initialization error)
export const NOTIFY_PROJECT_INIT_ERROR = {
  title: "Initialization Error",
  message: "Something went wrong loading your projects.",
};

// Used in: ProjectsView.vue (offers load error)
export const NOTIFY_OFFERS_LOAD_ERROR = {
  title: "Offer Load Error",
  message: "Failed to get offers from the server.",
};

// Used in: ProjectsView.vue (offers fetch error)
export const NOTIFY_OFFERS_FETCH_ERROR = {
  title: "Offer Fetch Error",
  message: "Got an error loading offers.",
};

// ProjectsView.vue complex modals
// Used in: ProjectsView.vue (complex modal for camera sharing method)
export const NOTIFY_CAMERA_SHARE_METHOD = {
  title: "Are you nearby with cameras?",
  text: "If so, we'll use those with QR codes to share.",
  yesText: "we are nearby with cameras",
  noText: "we will share another way",
};

// SharedPhotoView.vue constants
// Used in: SharedPhotoView.vue (photo data loading error)
export const NOTIFY_SHARED_PHOTO_LOAD_ERROR = {
  title: "Error",
  message: "Got an error loading this data.",
};

// Used in: SharedPhotoView.vue (photo saving error)
export const NOTIFY_SHARED_PHOTO_SAVE_ERROR = {
  title: "Error",
  message: "There was a problem saving the picture.",
};

// OfferDialog.vue constants
// Used in: OfferDialog.vue (settings retrieval error)
export const NOTIFY_OFFER_SETTINGS_ERROR = {
  title: "Error",
  message: "There was an error retrieving your settings.",
};

// Used in: OfferDialog.vue (offer recording in progress)
export const NOTIFY_OFFER_RECORDING = {
  text: "Recording the offer...",
  title: "",
};

// Used in: OfferDialog.vue (identity required for offer)
export const NOTIFY_OFFER_IDENTITY_REQUIRED = {
  title: "Error",
  message: "You must select an identity before you can record an offer.",
};

// Used in: OfferDialog.vue (description required for offer)
export const NOTIFY_OFFER_DESCRIPTION_REQUIRED = {
  title: "Error",
  message: "You must enter a description or some number of {unit}.",
};

// Used in: OfferDialog.vue (offer creation error)
export const NOTIFY_OFFER_CREATION_ERROR = {
  title: "Error",
  message: "There was an error creating the offer.",
};

// Used in: OfferDialog.vue (offer recorded successfully)
export const NOTIFY_OFFER_SUCCESS = {
  title: "Success",
  message: "That offer was recorded.",
};

// Used in: OfferDialog.vue (offer submission error)
export const NOTIFY_OFFER_SUBMISSION_ERROR = {
  title: "Error",
  message: "There was an error recording the offer.",
};

// PhotoDialog.vue constants
// Used in: PhotoDialog.vue (settings retrieval error)
export const NOTIFY_PHOTO_SETTINGS_ERROR = {
  title: "Error",
  message: "There was an error retrieving your settings.",
};

// Used in: PhotoDialog.vue (photo capture error)
export const NOTIFY_PHOTO_CAPTURE_ERROR = {
  title: "Error",
  message: "Failed to take picture. Please try again.",
};

// Used in: PhotoDialog.vue (camera access error)
export const NOTIFY_PHOTO_CAMERA_ERROR = {
  title: "Camera Error",
  message: "Could not access camera. Please check permissions and try again.",
};

// Used in: PhotoDialog.vue (photo upload error)
export const NOTIFY_PHOTO_UPLOAD_ERROR = {
  title: "Upload Error",
  message: "Failed to upload image. Please try again.",
};

// Used in: PhotoDialog.vue (photo upload success)
export const NOTIFY_PHOTO_UPLOAD_SUCCESS = {
  title: "Success",
  message: "Image uploaded successfully.",
};

// Used in: PhotoDialog.vue (unsupported file format)
export const NOTIFY_PHOTO_UNSUPPORTED_FORMAT = {
  title: "Unsupported Format",
  message: "This file format is not supported. Please try a different image.",
};

// Used in: PhotoDialog.vue (file size too large)
export const NOTIFY_PHOTO_SIZE_ERROR = {
  title: "File Too Large",
  message: "Image file is too large. Please choose a smaller image.",
};

// Used in: PhotoDialog.vue (image processing error)
export const NOTIFY_PHOTO_PROCESSING_ERROR = {
  title: "Processing Error",
  message: "Failed to process image. Please try again.",
};

// OnboardMeetingSetupView.vue constants
// Used in: OnboardMeetingSetupView.vue (meeting time validation)
export const NOTIFY_MEETING_INVALID_TIME = {
  title: "Invalid Time",
  message: "Select a future time for the meeting expiration.",
};

// Used in: OnboardMeetingSetupView.vue (meeting name validation)
export const NOTIFY_MEETING_NAME_REQUIRED = {
  title: "Invalid Name",
  message: "Please enter your name.",
};

// Used in: OnboardMeetingSetupView.vue (meeting password validation)
export const NOTIFY_MEETING_PASSWORD_REQUIRED = {
  title: "Invalid Password",
  message: "Please enter a password.",
};

// Used in: OnboardMeetingSetupView.vue (meeting creation success)
export const NOTIFY_MEETING_CREATED = {
  title: "Success",
  message: "Meeting created.",
};

// Used in: OnboardMeetingSetupView.vue (meeting deletion success)
export const NOTIFY_MEETING_DELETED = {
  title: "Success",
  message: "Meeting deleted successfully.",
};

// Used in: OnboardMeetingSetupView.vue (member link copied)
export const NOTIFY_MEETING_LINK_COPIED = {
  title: "Copied",
  message: "The member link is copied to the clipboard.",
};

// ContactsView.vue extracted notification messages
// Used in: ContactsView.vue (onClickNewContact method - no contact info error)
export const NOTIFY_CONTACT_NO_INFO = {
  title: "No Contact Info",
  message: "There was no contact info to add. Try the other green buttons.",
};

// Used in: [Component usage not yet documented]
export const NOTIFY_CONTACT_INVALID_URL = {
  title: "Invalid URL",
  message: "Invalid contact URL format.",
};

// Used in: ContactsView.vue (onClickNewContact method - CSV contacts added success)
export const NOTIFY_CONTACTS_ADDED_CSV = {
  title: "Contacts Added",
  message: "Each contact was added. Nothing was sent to the server.",
};

// Used in: ContactsView.vue (onClickNewContact method - CSV add error)
export const NOTIFY_CONTACTS_ADD_ERROR = {
  title: "Add Contacts Error",
  message: "An error occurred. Some contacts may have been added.",
};

// Used in: ContactsView.vue (onClickNewContact method - JSON array parse error)
export const NOTIFY_CONTACT_INPUT_PARSE_ERROR = {
  title: "Invalid Contact List",
  message: "The input could not be parsed.",
};

// Used in: ContactsView.vue (onClickNewContact method - no contact found in input)
export const NOTIFY_CONTACT_NO_CONTACT_FOUND = {
  title: "No Contact Info",
  message: "No contact info was found in that input.",
};

// Used in: ContactsView.vue (addContact method - contact has no DID)
export const NOTIFY_CONTACT_NO_DID = {
  title: "Incomplete Contact",
  message: "Cannot add a contact without a DID.",
};

// Used in: ContactsView.vue (addContact method - invalid DID format)
export const NOTIFY_CONTACT_INVALID_DID = {
  title: "Invalid DID",
  message: "The DID must begin with 'did:'",
};

// Used in: ContactsView.vue (addContact method - contact import error)
export const NOTIFY_CONTACT_IMPORT_ERROR = {
  title: "Contact Not Added",
  message: "An error prevented this import.",
};

// Used in: ContactsView.vue (addContact method - contact already exists)
export const NOTIFY_CONTACT_IMPORT_CONFLICT = {
  title: "Contact Not Added",
  message:
    "A contact with that DID is already in your contact list. Edit them directly below.",
};

// Used in: ContactsView.vue (addContact method - constraint error)
export const NOTIFY_CONTACT_IMPORT_CONSTRAINT = {
  title: "Contact Not Added",
  message: "Check that the contact doesn't conflict with any you already have.",
};

// Used in: ContactsView.vue (loadGives method - gives loading error)
export const NOTIFY_GIVES_LOAD_ERROR = {
  title: "Gives Load Error",
  message: "Got an error loading your gives.",
};

// Used in: ContactsView.vue (toggleShowContactAmounts method - setting save error)
export const NOTIFY_CONTACT_SETTING_SAVE_ERROR = {
  title: "Setting Save Error",
  message:
    "The setting may not have saved. Try again, maybe after restarting the app.",
};

// Used in: ContactsView.vue (showOnboardMeetingDialog method - meeting status error)
export const NOTIFY_MEETING_STATUS_ERROR = {
  title: "Meeting Error",
  message: "There was an error checking your meeting status.",
};

// Used in: ContactsView.vue (addContact method - contact added with visibility)
export const NOTIFY_CONTACTS_ADDED_VISIBLE = {
  title: "Contact Added",
  message: "They were added, and your activity is visible to them.",
};

// Used in: ContactsView.vue (addContact method - contact added without visibility)
export const NOTIFY_CONTACTS_ADDED = {
  title: "Contact Added",
  message: "They were added.",
};

// Used in: ContactsView.vue (addContact method - export data prompt after contact addition)
export const NOTIFY_EXPORT_DATA_PROMPT = {
  title: "Export Your Data",
  message: "Would you like to export your contact data as a backup?",
};

// Used in: ContactsView.vue (showCopySelectionsInfo method - info about copying contacts)
export const NOTIFY_CONTACT_INFO_COPY = {
  title: "Info",
  message:
    "Copied contact info will include name, ID, profile image, and public key.",
};

// Used in: ContactsView.vue (copySelectedContacts method - no contacts selected error)
export const NOTIFY_CONTACTS_SELECT_TO_COPY = {
  title: "Select Contacts",
  message: "You must select contacts to copy.",
};

// Used in: ContactsView.vue (copySelectedContacts method - contact link copied success)
export const NOTIFY_CONTACT_LINK_COPIED = {
  title: "Copied",
  message: "Contact link",
};

// Template for registration success message
// Used in: ContactsView.vue (register method - registration success with contact name)
export const getRegisterPersonSuccessMessage = (name?: string): string =>
  `${name || THAT_UNNAMED_PERSON} ${NOTIFY_REGISTER_PERSON_SUCCESS.message}`;

// Template for visibility success message
// Used in: ContactsView.vue (setVisibility method - visibility success with contact name)
export const getVisibilitySuccessMessage = (
  name?: string,
  visible = true,
): string =>
  `${name || "That user"} can ${visible ? "" : "not "}see your activity.`;

// Template for gives retrieval error message
// Used in: ContactsView.vue (loadGives method - gives retrieval error with direction)
export const getGivesRetrievalErrorMessage = (useRecipient: boolean): string =>
  `Got an error retrieving your ${useRecipient ? "given" : "received"} data from the server.`;

// Additional constants for ContactsView.vue
// Used in: ContactsView.vue (register method - registration error fallback)
export const NOTIFY_REGISTRATION_ERROR_FALLBACK = {
  title: "Registration Error",
  message: "Something went wrong during registration.",
};

// Used in: ContactsView.vue (register method - generic registration error)
export const NOTIFY_REGISTRATION_ERROR_GENERIC = {
  title: "Registration Error",
  message: "There was an error.",
};

// Used in: ContactsView.vue (setVisibility method - visibility error fallback)
export const NOTIFY_VISIBILITY_ERROR_FALLBACK = {
  title: "Error Setting Visibility",
  message: "Could not set visibility on the server.",
};

// ContactEditView.vue constants
// Used in: ContactEditView.vue (contact not found error)
export const NOTIFY_CONTACT_NOT_FOUND = {
  title: "Contact Not Found",
  message: "Contact not found with DID",
};

// Used in: ContactEditView.vue (contact methods updated)
export const NOTIFY_CONTACT_METHODS_UPDATED = {
  title: "Contact Methods Updated",
  message:
    "Contact methods updated. Note that some methods have been updated, such as uppercasing 'email' to 'EMAIL'. Save again if the changes are acceptable.",
};

// Used in: ContactEditView.vue (contact saved successfully)
export const NOTIFY_CONTACT_SAVED = {
  title: "Contact Saved",
  message: "Contact saved successfully",
};

/**
 * Creates a contact not found error message with the specific DID
 * Used in: [Component usage not yet documented]
 */
export const createContactNotFoundMessage = (did: string): string =>
  `${NOTIFY_CONTACT_NOT_FOUND.message} ${did}`;

/**
 * Creates a SQL error notification message
 * Used in: TestView.vue (executeSql method)
 */
export const createSqlErrorMessage = (error: unknown): string => {
  const errorMessage = error instanceof Error ? error.message : String(error);
  return errorMessage;
};

/**
 * Creates passkey name requirement modal configuration
 * Used in: TestView.vue (register method)
 */
export const createPasskeyNameModal = (
  defaultUsername: string,
  onNoCallback: () => Promise<void>,
  onYesCallback: () => Promise<void>,
) => ({
  group: "modal",
  type: "confirm",
  title: NOTIFY_PASSKEY_NAME_REQUIRED.title,
  text: NOTIFY_PASSKEY_NAME_REQUIRED.text,
  onNo: onNoCallback,
  onYes: onYesCallback,
  noText: `${NOTIFY_PASSKEY_NAME_REQUIRED.noText} ${defaultUsername}`,
});

// ContactAmountsView.vue constants
// Used in: ContactAmountsView.vue (settings retrieval error)
export const NOTIFY_SETTINGS_RETRIEVAL_ERROR = {
  title: "Error",
  message: "There was an error retrieving your settings or contacts or gives.",
};

// Used in: ContactAmountsView.vue (server retrieval error)
export const NOTIFY_SERVER_RETRIEVAL_ERROR = {
  title: "Error With Server",
  message: "Got an error retrieving your given time from the server.",
};

// Used in: ContactAmountsView.vue (confirmation restriction)
export const NOTIFY_CONFIRMATION_RESTRICTION = {
  title: "Not Allowed",
  message: "Only the recipient can confirm final receipt.",
};

// =================================================
// INVITE MANAGEMENT NOTIFICATIONS
// =================================================

/**
 * Invite Management Notifications
 * For InviteOneView.vue component
 */
export const NOTIFY_INVITE_LOAD_ERROR = {
  group: "alert",
  type: "danger",
  title: "Load Error",
  message: "Got an error loading your invites.",
} as const;

export const NOTIFY_INVITE_LINK_COPIED = {
  group: "alert",
  type: "success",
  title: "Copied",
  message: "Your clipboard now contains the link for invite",
} as const;

export const NOTIFY_INVITE_ID_COPIED = {
  group: "alert",
  type: "success",
  title: "Copied",
  message: "Your clipboard now contains the invite ID",
} as const;

export const NOTIFY_CONTACT_ADDED = {
  group: "alert",
  type: "success",
  title: "Contact Added",
  message: "has been added to your contacts.",
} as const;

export const NOTIFY_INVITE_DELETE_CONFIRM = {
  group: "modal",
  type: "confirm",
  title: "Delete Invite?",
  message: "Are you sure you want to erase the invite for",
} as const;

export const NOTIFY_INVITE_DELETED = {
  group: "alert",
  type: "success",
  title: "Deleted",
  message: "Invite deleted.",
} as const;

/**
 * Creates invite link copy notification message
 * @param inviteId - ID of the invitation
 * @returns Formatted notification message
 */
export function createInviteLinkCopyMessage(inviteId: string): string {
  return `${NOTIFY_INVITE_LINK_COPIED.message} ${inviteId}`;
}

/**
 * Creates invite ID copy notification message with status
 * @param inviteId - ID of the invitation
 * @param redeemed - Whether invite has been redeemed
 * @param expired - Whether invite has expired
 * @returns Formatted notification message
 */
export function createInviteIdCopyMessage(
  inviteId: string,
  redeemed: boolean,
  expired: boolean,
): string {
  let message = `${NOTIFY_INVITE_ID_COPIED.message} ${inviteId}`;
  if (redeemed) {
    message += " (This invite has been used.)";
  } else if (expired) {
    message += " (This invite has expired.)";
  }
  return message;
}

/**
 * Creates contact added notification message
 * @param contactName - Name of the contact added
 * @returns Formatted notification message
 */
export function createContactAddedMessage(contactName: string): string {
  return `${contactName} ${NOTIFY_CONTACT_ADDED.message}`;
}

/**
 * Creates invite delete confirmation message
 * @param notes - Notes from the invite
 * @returns Formatted confirmation message
 */
export function createInviteDeleteConfirmMessage(notes: string): string {
  return `${NOTIFY_INVITE_DELETE_CONFIRM.message} "${notes}"? (There is no undo.)`;
}

/**
 * Creates confirmation success message based on count
 * @param count - Number of confirmations
 * @returns Formatted success message
 */
export function createConfirmationSuccessMessage(count: number): string {
  return count === 1
    ? NOTIFY_SINGLE_CONFIRMATION_SUCCESS.message
    : NOTIFY_MULTIPLE_CONFIRMATIONS_SUCCESS.message;
}

/**
 * Creates combined success message for confirmations and give
 * @param confirmCount - Number of confirmations
 * @param hasGive - Whether a give was also recorded
 * @returns Formatted success message
 */
export function createCombinedSuccessMessage(
  confirmCount: number,
  hasGive: boolean,
): string {
  if (confirmCount > 0 && hasGive) {
    return NOTIFY_CONFIRMATIONS_AND_GIVE_SUCCESS.message;
  } else if (hasGive) {
    return NOTIFY_GIVE_SUCCESS.message;
  } else {
    const confirms = confirmCount === 1 ? "confirmation" : "confirmations";
    const hasHave = confirmCount === 1 ? "has" : "have";
    return `Your ${confirms} ${hasHave} been recorded.`;
  }
}

// ConfirmGiftView.vue additional constants
// Used in: ConfirmGiftView.vue (confirmClaim method - success)
export const NOTIFY_GIFT_CONFIRMATION_SUCCESS = {
  title: "Success",
  message: "Confirmation submitted.",
};

// Used in: ConfirmGiftView.vue (confirmClaim method - error)
export const NOTIFY_GIFT_CONFIRMATION_ERROR = {
  title: "Error",
  message: "There was a problem submitting the confirmation.",
};

// Used in: ConfirmGiftView.vue (confirmConfirmClaim method - confirm modal)
export const NOTIFY_GIFT_CONFIRM_MODAL = {
  title: "Confirm",
  message: "Do you personally confirm that this is true?",
};

// Used in: ConfirmGiftView.vue (copyToClipboard method - copied toast)
export const NOTIFY_COPIED_TO_CLIPBOARD = {
  title: "Copied",
  message: (description?: string) =>
    `${description || "That"} was copied to the clipboard.`,
};

// DiscoverView.vue specific constants
// Used in: DiscoverView.vue (searchAll method - search error)
export const NOTIFY_DISCOVER_SEARCH_ERROR = {
  title: "Error",
  message: "There was an error with the search.",
};

// Used in: DiscoverView.vue (searchLocal method - local search error)
export const NOTIFY_DISCOVER_LOCAL_SEARCH_ERROR = {
  title: "Error",
  message: "There was an error with the local search.",
};

// Used in: DiscoverView.vue (requestTiles method - map search error)
export const NOTIFY_DISCOVER_MAP_SEARCH_ERROR = {
  title: "Error",
  message: "There was an error with the map search.",
};

// ClaimCertificateView.vue specific constants
// Used in: ClaimCertificateView.vue (fetchClaim method - claim loading error)
export const NOTIFY_CLAIM_CERTIFICATE_LOAD_ERROR = {
  title: "Error",
  message: "There was a problem loading the claim.",
};

// ImportDerivedAccountView.vue specific constants
// Used in: ImportDerivedAccountView.vue (incrementDerivation method - success)
export const NOTIFY_ACCOUNT_DERIVATION_SUCCESS = {
  title: "Success",
  message: "Account derived and imported successfully.",
};

// Used in: ImportDerivedAccountView.vue (incrementDerivation method - error)
export const NOTIFY_ACCOUNT_DERIVATION_ERROR = {
  title: "Error",
  message: "There was a problem deriving and importing the account.",
};

// GiftedDetailsView.vue notification constants
export const NOTIFY_GIFTED_DETAILS_RETRIEVAL_ERROR = {
  title: "Retrieval Error",
  message:
    "The previous record isn't available for editing. If you submit, you'll create a new record.",
};

export const NOTIFY_GIFTED_DETAILS_DELETE_IMAGE_CONFIRM = {
  title: "Are you sure you want to delete the image?",
  message: "",
};

export const NOTIFY_GIFTED_DETAILS_DELETE_IMAGE_ERROR = {
  title: "Error",
  message: "There was a problem deleting the image.",
};

export const NOTIFY_GIFTED_DETAILS_NO_IDENTIFIER = {
  title: "Missing Identifier",
  message: "You must select an identifier before you can record a give.",
};

export const NOTIFY_GIFTED_DETAILS_RECORDING_GIVE = {
  title: "",
  message: "Recording the give...",
};

export const NOTIFY_GIFTED_DETAILS_CREATE_GIVE_ERROR = {
  title: "Error",
  message: "There was an error creating the give.",
};

export const NOTIFY_GIFTED_DETAILS_GIFT_RECORDED = {
  title: "Success",
  message: "That gift was recorded.",
};

// SearchAreaView.vue Notification Messages
export const NOTIFY_SEARCH_AREA_SAVED = {
  group: "alert",
  type: "success",
  title: "Saved",
  text: "That has been saved in your preferences. You can now filter by it on your home screen feed.",
} as const;

export const NOTIFY_SEARCH_AREA_ERROR = {
  group: "alert",
  type: "danger",
  title: "Error Updating Search Settings",
  text: "Try going to a different page and then coming back.",
} as const;

export const NOTIFY_SEARCH_AREA_NO_LOCATION = {
  group: "alert",
  type: "warning",
  title: "No Location Selected",
  text: "Select a location on the map.",
} as const;

export const NOTIFY_SEARCH_AREA_DELETED = {
  group: "alert",
  type: "success",
  title: "Location Deleted",
  text: "Your stored search area has been removed. Location filtering is now disabled.",
} as const;

// ContactQRScanShowView.vue specific constants
// Used in: ContactQRScanShowView.vue (created method - initialization error)
export const NOTIFY_QR_INITIALIZATION_ERROR = {
  title: "Initialization Error",
  message: "Failed to initialize QR renderer or scanner. Please try again.",
};

// Used in: ContactQRScanShowView.vue (startScanning method - camera in use)
export const NOTIFY_QR_CAMERA_IN_USE = {
  title: "Camera in Use",
  message: "Please close other applications using the camera and try again",
};

// Used in: ContactQRScanShowView.vue (startScanning method - camera access required)
export const NOTIFY_QR_CAMERA_ACCESS_REQUIRED = {
  title: "Camera Access Required",
  message: "Please grant camera permission to scan QR codes",
};

// Used in: ContactQRScanShowView.vue (startScanning method - no camera)
export const NOTIFY_QR_NO_CAMERA = {
  title: "No Camera",
  message: "No camera was found on this device",
};

// Used in: ContactQRScanShowView.vue (startScanning method - HTTPS required)
export const NOTIFY_QR_HTTPS_REQUIRED = {
  title: "HTTPS Required",
  message: "Camera access requires a secure (HTTPS) connection",
};

// Used in: ContactQRScanShowView.vue (addNewContact method - contact exists)
export const NOTIFY_QR_CONTACT_EXISTS = {
  title: "Contact Exists",
  message: "This contact has already been added to your list.",
};

// Used in: ContactQRScanShowView.vue (addNewContact method - contact added)
export const NOTIFY_QR_CONTACT_ADDED = {
  title: "Contact Added",
  message: "They were added, and your activity is visible to them.",
};

// Used in: ContactQRScanShowView.vue (addNewContact method - contact added without visibility)
export const NOTIFY_QR_CONTACT_ADDED_NO_VISIBILITY = {
  title: "Contact Added",
  message: "They were added.",
};

// Used in: ContactQRScanShowView.vue (addNewContact method - contact error)
export const NOTIFY_QR_CONTACT_ERROR = {
  title: "Contact Error",
  message: "Could not save contact. Check if it already exists.",
};

// Used in: ContactQRScanShowView.vue (register method - registration submitted)
export const NOTIFY_QR_REGISTRATION_SUBMITTED = {
  title: "",
  message: "Registration submitted...",
};

// Used in: ContactQRScanShowView.vue (register method - registration success)
export const NOTIFY_QR_REGISTRATION_SUCCESS = {
  title: "Registration Success",
  message: " has been registered.",
};

// Used in: ContactQRScanShowView.vue (register method - registration error)
export const NOTIFY_QR_REGISTRATION_ERROR = {
  title: "Registration Error",
  message: "Something went wrong during registration.",
};

// Used in: ContactQRScanShowView.vue (onCopyUrlToClipboard method - URL copied)
export const NOTIFY_QR_URL_COPIED = {
  title: "Copied",
  message: "Contact URL was copied to clipboard.",
};

// Used in: ContactQRScanShowView.vue (toastQRCodeHelp method - QR code help)
export const NOTIFY_QR_CODE_HELP = {
  title: "QR Code Help",
  message: "Click the QR code to copy your contact info to your clipboard.",
};

// Used in: ContactQRScanShowView.vue (onCopyDidToClipboard method - DID copied)
export const NOTIFY_QR_DID_COPIED = {
  title: "Copied",
  message:
    "Your DID was copied to the clipboard. Have them paste it in the box on their 'People' screen to add you.",
};

// Used in: ContactQRScanShowView.vue (onScanDetect method - invalid QR code)
export const NOTIFY_QR_INVALID_QR_CODE = {
  title: "Invalid QR Code",
  message:
    "This QR code does not contain valid contact information. Scan a TimeSafari contact QR code.",
};

// Used in: ContactQRScanShowView.vue (onScanDetect method - invalid contact info)
export const NOTIFY_QR_INVALID_CONTACT_INFO = {
  title: "Invalid Contact Info",
  message: "The contact information is incomplete or invalid.",
};

// Used in: ContactQRScanShowView.vue (onScanDetect method - missing DID)
export const NOTIFY_QR_MISSING_DID = {
  title: "Invalid Contact",
  message: "The contact DID is missing.",
};

// Used in: ContactQRScanShowView.vue (onScanDetect method - unknown contact type)
export const NOTIFY_QR_UNKNOWN_CONTACT_TYPE = {
  title: "Error",
  message:
    "Could not determine the type of contact info. Try again, or tap the QR code to copy it and send it to them.",
};

// Used in: ContactQRScanShowView.vue (onScanDetect method - processing error)
export const NOTIFY_QR_PROCESSING_ERROR = {
  title: "Error",
  message: "Could not process QR code. Please try again.",
};

// Helper function for dynamic contact added messages
// Used in: ContactQRScanShowView.vue (addNewContact method - dynamic contact added message)
export function createQRContactAddedMessage(hasVisibility: boolean): string {
  return hasVisibility
    ? NOTIFY_QR_CONTACT_ADDED.message
    : NOTIFY_QR_CONTACT_ADDED_NO_VISIBILITY.message;
}

// Helper function for dynamic registration success messages
// Used in: ContactQRScanShowView.vue (register method - dynamic success message)
export function createQRRegistrationSuccessMessage(
  contactName: string,
): string {
  return `${contactName || THAT_UNNAMED_PERSON}${NOTIFY_QR_REGISTRATION_SUCCESS.message}`;
}

// ContactQRScanShowView.vue timeout constants
export const QR_TIMEOUT_SHORT = 1000; // Short operations like registration submission
export const QR_TIMEOUT_MEDIUM = 2000; // Medium operations like URL copy
export const QR_TIMEOUT_STANDARD = 3000; // Standard success messages
export const QR_TIMEOUT_LONG = 5000; // Error messages and warnings

// NewEditProjectView.vue specific constants
// Used in: NewEditProjectView.vue (mounted method - account loading error)
export const NOTIFY_PROJECT_ACCOUNT_LOADING_ERROR = {
  title: "Account Loading Error",
  message: "There was a problem loading your account info.",
};

// Used in: NewEditProjectView.vue (loadProject method - project retrieval error)
export const NOTIFY_PROJECT_RETRIEVAL_ERROR = {
  title: "Project Retrieval Error",
  message: "There was an error retrieving that project.",
};

// Used in: NewEditProjectView.vue (confirmDeleteImage method - image deletion confirmation)
export const NOTIFY_PROJECT_DELETE_IMAGE_CONFIRM = {
  title: "Delete Image",
  message: "Are you sure you want to delete the image?",
};

// Used in: NewEditProjectView.vue (deleteImage method - image deletion error)
export const NOTIFY_PROJECT_DELETE_IMAGE_ERROR = {
  title: "Image Deletion Error",
  message: "There was a problem deleting the image.",
};

// Used in: NewEditProjectView.vue (deleteImage method - image deletion general error)
export const NOTIFY_PROJECT_DELETE_IMAGE_GENERAL_ERROR = {
  title: "Image Deletion Error",
  message: "There was an error deleting the image.",
};

// Used in: NewEditProjectView.vue (validateLocation method - invalid location error)
export const NOTIFY_PROJECT_INVALID_LOCATION = {
  title: "Invalid Location",
  message: "The location was invalid so it was not set.",
};

// Used in: NewEditProjectView.vue (validateStartDate method - invalid start date error)
export const NOTIFY_PROJECT_INVALID_START_DATE = {
  title: "Invalid Start Date",
  message: "The start date was invalid so it was not set.",
};

// Used in: NewEditProjectView.vue (validateEndDate method - invalid end date error)
export const NOTIFY_PROJECT_INVALID_END_DATE = {
  title: "Invalid End Date",
  message: "The end date was invalid so it was not set.",
};

// Used in: NewEditProjectView.vue (saveProject method - project save success)
export const NOTIFY_PROJECT_SAVE_SUCCESS = {
  title: "Success",
  message: "The project was saved successfully.",
};

// Used in: NewEditProjectView.vue (saveProject method - partner location warning)
export const NOTIFY_PROJECT_PARTNER_LOCATION_WARNING = {
  title: "Partner Location Warning",
  message:
    "A partner was selected but the location was not set, so it was not sent to any partner.",
};

// Used in: NewEditProjectView.vue (sendToNostrPartner method - partner send success)
export const NOTIFY_PROJECT_PARTNER_SEND_SUCCESS = {
  title: "Partner Integration Success",
  message: "The project info was sent to",
};

// Used in: NewEditProjectView.vue (sendToNostrPartner method - partner send error)
export const NOTIFY_PROJECT_PARTNER_SEND_ERROR = {
  title: "Partner Integration Error",
  message: "Failed sending to",
};

// Used in: NewEditProjectView.vue (sendToNostrPartner method - partner send general error)
export const NOTIFY_PROJECT_PARTNER_SEND_GENERAL_ERROR = {
  title: "Partner Integration Error",
  message: "There was an error sending to the partner service.",
};

// Used in: NewEditProjectView.vue (confirmEraseLatLong method - location deletion confirmation)
export const NOTIFY_PROJECT_DELETE_LOCATION_CONFIRM = {
  title: "Delete Location",
  message: "Are you sure you want to delete the location?",
};

// Used in: NewEditProjectView.vue (showNostrPartnerInfo method - partner info)
export const NOTIFY_PROJECT_NOSTR_PARTNER_INFO = {
  title: "Partner Integration Info",
  message:
    "This will share your project information with external partner services using Nostr protocol.",
};

// Helper function for dynamic partner send success messages
// Used in: NewEditProjectView.vue (sendToNostrPartner method - dynamic success message)
export function createProjectPartnerSendSuccessMessage(
  serviceName: string,
): string {
  return `${NOTIFY_PROJECT_PARTNER_SEND_SUCCESS.message} ${serviceName}.`;
}

// Helper function for dynamic partner send error messages
// Used in: NewEditProjectView.vue (sendToNostrPartner method - dynamic error message)
export function createProjectPartnerSendErrorMessage(
  serviceName: string,
  errorData: string,
): string {
  return `${NOTIFY_PROJECT_PARTNER_SEND_ERROR.message} ${serviceName}: ${errorData}`;
}

// NewEditProjectView.vue timeout constants
export const PROJECT_TIMEOUT_SHORT = 1000; // Short operations like confirmations
export const PROJECT_TIMEOUT_STANDARD = 3000; // Standard success messages
export const PROJECT_TIMEOUT_LONG = 5000; // Error messages and warnings
export const PROJECT_TIMEOUT_VERY_LONG = 7000; // Complex operations and partner errors

// ImageMethodDialog.vue specific constants
// Used in: ImageMethodDialog.vue (mounted method - settings retrieval error)
export const NOTIFY_IMAGE_DIALOG_SETTINGS_ERROR = {
  title: "Error",
  message: "There was an error retrieving your settings.",
};

// Used in: ImageMethodDialog.vue (acceptUrl method - image retrieval error)
export const NOTIFY_IMAGE_DIALOG_RETRIEVAL_ERROR = {
  title: "Error",
  message: "There was an error retrieving that image.",
};

// Used in: ImageMethodDialog.vue (startCameraPreview method - camera access error)
export const NOTIFY_IMAGE_DIALOG_CAMERA_ACCESS_ERROR = {
  title: "Error",
  message: "Failed to access camera",
};

// Used in: ImageMethodDialog.vue (startCameraPreview method - camera in use error)
export const NOTIFY_IMAGE_DIALOG_CAMERA_IN_USE = {
  title: "Camera in Use",
  message:
    "Camera is in use by another application. Please close any other apps or browser tabs using the camera and try again.",
};

// Used in: ImageMethodDialog.vue (startCameraPreview method - camera permission denied)
export const NOTIFY_IMAGE_DIALOG_CAMERA_PERMISSION_DENIED = {
  title: "Camera Access Denied",
  message:
    "Camera access was denied. Please allow camera access in your browser settings.",
};

// Used in: ImageMethodDialog.vue (capturePhoto method - photo capture error)
export const NOTIFY_IMAGE_DIALOG_CAPTURE_ERROR = {
  title: "Error",
  message: "Failed to capture photo. Please try again.",
};

// Used in: ImageMethodDialog.vue (uploadImage method - no image found error)
export const NOTIFY_IMAGE_DIALOG_NO_IMAGE_ERROR = {
  title: "Error",
  message: "There was an error finding the picture. Please try again.",
};

// Used in: ImageMethodDialog.vue (uploadImage method - general upload error)
export const NOTIFY_IMAGE_DIALOG_UPLOAD_ERROR = {
  title: "Error",
  message: "There was an error saving the picture.",
};

// Used in: ImageMethodDialog.vue (uploadImage method - authentication error)
export const NOTIFY_IMAGE_DIALOG_AUTH_ERROR = {
  title: "Authentication Error",
  message: "Authentication failed. Please try logging in again.",
};

// Used in: ImageMethodDialog.vue (uploadImage method - file too large error)
export const NOTIFY_IMAGE_DIALOG_FILE_TOO_LARGE = {
  title: "File Too Large",
  message: "Image file is too large. Please try a smaller image.",
};

// Used in: ImageMethodDialog.vue (uploadImage method - unsupported format error)
export const NOTIFY_IMAGE_DIALOG_UNSUPPORTED_FORMAT = {
  title: "Unsupported Format",
  message: "Unsupported image format. Please try a different image.",
};

// Used in: ImageMethodDialog.vue (uploadImage method - server error)
export const NOTIFY_IMAGE_DIALOG_SERVER_ERROR = {
  title: "Server Error",
  message: "Server error. Please try again later.",
};

// Helper function for dynamic camera error messages
// Used in: ImageMethodDialog.vue (startCameraPreview method - dynamic camera error message)
export function createImageDialogCameraErrorMessage(error: Error): string {
  if (error.name === "NotReadableError" || error.name === "TrackStartError") {
    return NOTIFY_IMAGE_DIALOG_CAMERA_IN_USE.message;
  } else if (
    error.name === "NotAllowedError" ||
    error.name === "PermissionDeniedError"
  ) {
    return NOTIFY_IMAGE_DIALOG_CAMERA_PERMISSION_DENIED.message;
  }
  return error.message || NOTIFY_IMAGE_DIALOG_CAMERA_ACCESS_ERROR.message;
}

// Helper function for dynamic upload error messages
// Used in: ImageMethodDialog.vue (uploadImage method - dynamic upload error message)
export function createImageDialogUploadErrorMessage(error: unknown): string {
  if (axios.isAxiosError(error)) {
    const status = error.response?.status;
    const data = error.response?.data;

    if (status === 401) {
      return NOTIFY_IMAGE_DIALOG_AUTH_ERROR.message;
    } else if (status === 413) {
      return NOTIFY_IMAGE_DIALOG_FILE_TOO_LARGE.message;
    } else if (status === 415) {
      return NOTIFY_IMAGE_DIALOG_UNSUPPORTED_FORMAT.message;
    } else if (status && status >= 500) {
      return NOTIFY_IMAGE_DIALOG_SERVER_ERROR.message;
    } else if (data?.message) {
      return data.message;
    }
  }
  return NOTIFY_IMAGE_DIALOG_UPLOAD_ERROR.message;
}

// ImageMethodDialog.vue timeout constants
export const IMAGE_DIALOG_TIMEOUT_STANDARD = 3000; // Standard error messages
export const IMAGE_DIALOG_TIMEOUT_LONG = 5000; // Camera and upload errors
export const IMAGE_DIALOG_TIMEOUT_MODAL = -1; // Modal confirmations (no auto-dismiss)

// PushNotificationPermission.vue specific constants
// Used in: PushNotificationPermission.vue (open method - VAPID key error)
export const NOTIFY_PUSH_VAPID_ERROR = {
  title: "Error Setting Notifications",
  message: "Could not set notifications.",
};

// Used in: PushNotificationPermission.vue (open method - initialization error)
export const NOTIFY_PUSH_INIT_ERROR = {
  title: "Error Setting Notifications",
  message: "Got an error setting notifications.",
};

// Used in: PushNotificationPermission.vue (checkNotificationSupport method - browser support error)
export const NOTIFY_PUSH_BROWSER_NOT_SUPPORTED = {
  title: "Browser Notifications Are Not Supported",
  message: "This browser does not support notifications.",
};

// Used in: PushNotificationPermission.vue (requestNotificationPermission method - permission error)
export const NOTIFY_PUSH_PERMISSION_ERROR = {
  title: "Error Requesting Notification Permission",
  message:
    "Allow this app permission to make notifications for personal reminders. You can adjust them at any time in your settings.",
};

// Used in: PushNotificationPermission.vue (turnOnNotifications method - setup underway)
export const NOTIFY_PUSH_SETUP_UNDERWAY = {
  title: "Notification Setup Underway",
  message:
    "Setting up notifications for interesting activity, which takes about 10 seconds. If you don't see a final confirmation, check the 'Troubleshoot' page.",
};

// Used in: PushNotificationPermission.vue (turnOnNotifications method - success)
export const NOTIFY_PUSH_SUCCESS = {
  title: "Notification Is On",
  message:
    "You should see at least one on your device; if not, check the 'Troubleshoot' link.",
};

// Used in: PushNotificationPermission.vue (turnOnNotifications method - general error)
export const NOTIFY_PUSH_SETUP_ERROR = {
  title: "Error Setting Notification Permissions",
  message: "Could not set notification permissions.",
};

// Used in: PushNotificationPermission.vue (subscribeToPush method - push subscription error)
export const NOTIFY_PUSH_SUBSCRIPTION_ERROR = {
  title: "Error Setting Push Notifications",
  message:
    "We encountered an issue setting up push notifications. If you wish to revoke notification permissions, please do so in your browser settings.",
};

// Push notification timeout constants
export const PUSH_NOTIFICATION_TIMEOUT_SHORT = 3000;
export const PUSH_NOTIFICATION_TIMEOUT_MEDIUM = 5000;
export const PUSH_NOTIFICATION_TIMEOUT_LONG = 7000;
export const PUSH_NOTIFICATION_TIMEOUT_PERSISTENT = -1;

// InviteOneAcceptView.vue timeout constants
export const INVITE_TIMEOUT_STANDARD = 3000; // Standard error messages
export const INVITE_TIMEOUT_LONG = 5000; // Missing invite and invalid data errors

// ContactsView.vue specific constants
// Used in: ContactsView.vue (showOnboardingInfo method - simple confirmation dialog)
export const NOTIFY_CONTACTS_ADDED_CONFIRM = {
  title: "They're Added To Your List",
  message: "Would you like to go to the main page now?",
};

// ImportAccountView.vue specific constants
// Used in: ImportAccountView.vue (onImportClick method - duplicate account warning)
export const NOTIFY_DUPLICATE_ACCOUNT_IMPORT = {
  title: "Account Already Imported",
  message:
    "This account has already been imported. Please use a different seed phrase or check your existing accounts.",
};
