# SPDX-License-Identifier: AGPL-3.0-only
# Copyright (c) 2026 sol pbc

"""Owner-facing copy constants for the curation app."""

from __future__ import annotations

from typing import Any

CUR_HEADING = "suggestions"
CUR_FACET_BODY = (
    "solstone noticed recent activity that doesn't fit your facets well. "
    'create a "{name}" facet?'
)
CUR_FACET_CREATE_ACTION = "create facet"
CUR_FACET_DISMISS_ACTION = "not now"
CUR_ENTITY_BODY = '"{a}" and "{b}" look like the same entity. merge them?'
CUR_ENTITY_MERGE_ACTION = "merge"
CUR_ENTITY_DISMISS_ACTION = "keep separate"
CUR_SPEAKER_BODY = (
    'solstone noticed "{source}" and "{target}" may be the same speaker. merge them?'
)
CUR_SPEAKER_MERGE_ACTION = "review merge"
CUR_SPEAKER_DISMISS_ACTION = "keep separate"
CUR_SPEAKER_CANDIDATE_PAIR_BODY = (
    "solstone found two speaker candidates that sound alike. merge them?"
)
CUR_SPEAKER_CANDIDATE_PAIR_MERGE_ACTION = "merge candidates"
CUR_SPEAKER_CANDIDATE_PAIR_DISMISS_ACTION = "keep separate"
CUR_SPEAKER_CANDIDATE_PAIR_SIMILARITY_LABEL = "cosine"
CUR_SPEAKER_CANDIDATE_PAIR_INTERVALS_LABEL = "intervals"
CUR_SPEAKER_CANDIDATE_PAIR_SOURCE_LABEL = "candidate A"
CUR_SPEAKER_CANDIDATE_PAIR_TARGET_LABEL = "candidate B"
CUR_EMPTY_STATE = (
    "nothing to review — solstone hasn't spotted new structure to suggest."
)
CUR_ENTITY_PREVIEW_LEAD = "before merging, here's what will change."
CUR_ENTITY_CONFIRM_ACTION = "confirm merge"
CUR_ENTITY_CANCEL_ACTION = "cancel"
CUR_ENTITY_SELECT_ALL_ACTION = "select all"
CUR_ENTITY_BATCH_MERGE_ACTION = "merge selected"
CUR_ENTITY_BATCH_DISMISS_ACTION = "keep selected separate"
CUR_ENTITY_BATCH_MERGE_LEAD = "these pairs will be merged:"
CUR_ENTITY_BATCH_DISMISS_LEAD = "these pairs will be kept separate:"
CUR_ENTITY_BATCH_CONFIRM_MERGE_ACTION = "merge all"
CUR_ENTITY_BATCH_CONFIRM_DISMISS_ACTION = "keep all separate"
CUR_ENTITY_BATCH_MERGE_SUMMARY = "merged {ok} of {total}."
CUR_ENTITY_BATCH_DISMISS_SUMMARY = "kept {ok} of {total} separate."
CUR_ENTITY_BATCH_FAILED_NOTE = "{failed} still need attention below."
CUR_AMBIGUITY_BODY = 'solstone found more than one possible match for "{query}".'
CUR_AMBIGUITY_ORIGIN_LABEL = "noticed in"
CUR_AMBIGUITY_CHOOSE_ACTION = "choose {name}"
CUR_UNDO_ACTION = "undo merge"
CUR_UNDO_DONE = "merge undone."
CUR_UNDO_UNAVAILABLE = "undo isn't available for this earlier merge."
CUR_UNDO_FAILED = "the merge couldn't be undone."
CUR_REPAIR_REQUIRED = "{detail} {remediation}"
CUR_ENTITY_PREVIEW_EMPTY = "no journal changes are needed for this merge."
CUR_ENTITY_PREVIEW_ERRORS = "some segment updates may need attention."
CUR_PREVIEW_AKAS_LABEL = "aliases added"
CUR_PREVIEW_EMAILS_LABEL = "emails added"
CUR_PREVIEW_FACETS_LABEL = "facet links"
CUR_PREVIEW_OBSERVATIONS_LABEL = "notes moved"
CUR_PREVIEW_SEGMENTS_LABEL = "speaker labels updated"
CUR_PREVIEW_VOICEPRINTS_LABEL = "voice samples moved"


def curation_copy_payload() -> dict[str, Any]:
    """Return copy constants for templates and browser code."""
    return {
        name: value
        for name, value in globals().items()
        if name.startswith("CUR_") and name.isupper()
    }


def curation_copy_values() -> list[str]:
    """Return all verbatim copy values, flattening list constants."""
    values: list[str] = []
    for value in curation_copy_payload().values():
        if isinstance(value, str):
            values.append(value)
        elif isinstance(value, list):
            values.extend(item for item in value if isinstance(item, str))
    return values
