# #region DictionaryManagerModule [C:4] [TYPE Module] [SEMANTICS sqlalchemy, translate, dictionary, batch, term]
# @BRIEF Business logic for terminology dictionary management, entry CRUD, CSV/TSV import with conflict detection, and per-batch filtering.
# @LAYER Domain
# @RELATION DEPENDS_ON -> [TranslationJob]
# @RELATION DEPENDS_ON -> [DictionaryEntry]
# @RELATION DEPENDS_ON -> [TerminologyDictionary]
# @RELATION DEPENDS_ON -> [TranslationJobDictionary]
# @RATIONALE C4 complexity because dictionary CRUD is stateful with referential integrity enforcement on deletion.
# @REJECTED "Keep both" as conflict option — UniqueConstraint prohibits variants; only overwrite/keep existing.
# @REJECTED Monolithic DictionaryManager class — violated INV_7. Decomposed into DictionaryCRUD, DictionaryEntryCRUD, DictionaryImportExport, DictionaryBatchFilter, DictionaryCorrectionService.
# @POST Dictionary and entry mutations are persisted with conflict detection.
# @PRE Database session is open and valid.
# @SIDE_EFFECT Creates, updates, deletes TerminologyDictionary and DictionaryEntry rows; enforces deletion guards.



from .dictionary_correction import DictionaryCorrectionService
from .dictionary_crud import DictionaryCRUD
from .dictionary_entries import DictionaryEntryCRUD
from .dictionary_filter import DictionaryBatchFilter
from .dictionary_import_export import DictionaryImportExport


# #region DictionaryManager [C:4] [TYPE Class]
# @BRIEF Facade for terminology dictionaries: delegates to DictionaryCRUD, DictionaryEntryCRUD, DictionaryImportExport, DictionaryBatchFilter, DictionaryCorrectionService.
# @PRE Database session is open and valid.
# @POST Dictionary and entry mutations are persisted with conflict detection.
# @SIDE_EFFECT Creates, updates, deletes TerminologyDictionary and DictionaryEntry rows; enforces deletion guards.
# @RATIONALE Thin facade preserves API compatibility after decomposition.
# @REJECTED Removing the facade would break all upstream imports; delegation pattern preferred.
class DictionaryManager:
    """Facade for terminology dictionary operations — delegates to specialized sub-classes."""

    # Dictionary CRUD
    create_dictionary = DictionaryCRUD.create_dictionary
    update_dictionary = DictionaryCRUD.update_dictionary
    delete_dictionary = DictionaryCRUD.delete_dictionary
    get_dictionary = DictionaryCRUD.get_dictionary
    list_dictionaries = DictionaryCRUD.list_dictionaries

    # Entry CRUD
    add_entry = DictionaryEntryCRUD.add_entry
    edit_entry = DictionaryEntryCRUD.edit_entry
    delete_entry = DictionaryEntryCRUD.delete_entry
    clear_entries = DictionaryEntryCRUD.clear_entries
    list_entries = DictionaryEntryCRUD.list_entries

    # Import/Export
    import_entries = DictionaryImportExport.import_entries
    export_entries = DictionaryImportExport.export_entries
    migrate_old_entries = DictionaryImportExport.migrate_old_entries

    # Batch filtering
    filter_for_batch = DictionaryBatchFilter.filter_for_batch

    # Corrections
    submit_correction = DictionaryCorrectionService.submit_correction
    submit_bulk_corrections = DictionaryCorrectionService.submit_bulk_corrections

# #endregion DictionaryManager


# #endregion DictionaryManagerModule
