"""ECM system role definitions."""

from enum import IntEnum


class ECMSystemRole(IntEnum):
    """ECMind Blue system roles as returned by ``mng.GetUserRoles``.

    Each member's integer value corresponds to the numeric role ID on the server.
    Unknown role IDs returned by the server are silently omitted from the result list.
    """

    # ── DMS ──────────────────────────────────────────────────────────────────
    DMS_SUPERVISOR = 18
    """DMS: Full DMS supervisor privileges."""
    DMS_LOCAL_SECURITY_GROUPS_SETUP = 66
    """DMS: Set up local security groups."""

    # ── Administrator ─────────────────────────────────────────────────────────
    ADMIN_START = 1
    """Administrator: Start the administrator application."""
    ADMIN_CONFIGURE_SYSTEM = 2
    """Administrator: Configure the entire system."""
    ADMIN_CONFIGURE_SECURITY = 4
    """Administrator: Configure the security system."""
    ADMIN_CONFIGURE_W_TEMPLATES = 5
    """Administrator: Configure W-templates."""
    ADMIN_CONFIGURE_ARCHIVE_PRINT = 6
    """Administrator: Configure archive print."""
    ADMIN_START_AUTOMATIC_ACTIONS = 8
    """Administrator: Start automatic actions."""
    ADMIN_CONFIGURE_AUTOMATIC_ACTIONS = 9
    """Administrator: Configure automatic actions."""
    ADMIN_VIEW_USER_TRAYS = 10
    """Administrator: View user trays."""
    ADMIN_EDIT_OBJECT_RIGHTS = 50
    """Administrator: Edit object rights."""
    ADMIN_CONFIGURE_LOCAL_SECURITY_GROUPS = 65
    """Administrator: Configure local security groups."""

    # ── Editor ────────────────────────────────────────────────────────────────
    EDITOR_START = 11
    """Editor: Start the editor application."""
    EDITOR_EDIT_OBJECT_DEFINITION = 12
    """Editor: Edit object definitions."""
    EDITOR_CUSTOMIZE_DATABASE = 13
    """Editor: Customize the database."""
    EDITOR_DEFINE_VISIBILITIES = 96
    """Editor: Define field and object visibilities."""

    # ── Start (portal/launcher) ───────────────────────────────────────────────
    START_APPLICATION = 14
    """Start: Start the Start portal application."""

    # ── Capture ───────────────────────────────────────────────────────────────
    CAPTURE_START = 15
    """Capture: Start the Capture application."""
    CAPTURE_CONFIGURE = 16
    """Capture: Configure the Capture application."""
    CAPTURE_EDIT_FILING_TRAY = 87
    """Capture: Edit the filing tray."""

    # ── Client ────────────────────────────────────────────────────────────────
    CLIENT_SAVE_PERSONAL_SETTINGS = 17
    """Client: Save personal settings."""
    CLIENT_OPEN_HISTORY = 28
    """Client: Open the history."""
    CLIENT_START_EXPERT_MODE = 29
    """Client: Start expert mode."""
    CLIENT_EXPORT_DOCUMENT_CONTENTS = 30
    """Client: Export document contents."""
    CLIENT_EDIT_NOTES = 31
    """Client: Edit notes."""
    CLIENT_RECOVER_FROM_HISTORY = 32
    """Client: Recover data from history."""
    CLIENT_SHOW_PERSONAL_RECYCLE_BIN = 33
    """Client: Show the personal recycle bin."""
    CLIENT_RUN_SQL_QUERIES = 34
    """Client: Run SQL queries."""
    CLIENT_SEND_CONTENT_AS_EMAIL = 35
    """Client: Send content as e-mail."""
    CLIENT_START = 36
    """Client: Start the client application."""
    CLIENT_SHOW_SYSTEM_RECYCLE_BIN = 37
    """Client: Show the system recycle bin."""
    CLIENT_EDIT_SQL_QUERIES = 38
    """Client: Edit SQL queries."""
    CLIENT_MANAGE_SUBSCRIPTIONS = 39
    """Client: Manage subscriptions."""
    CLIENT_DELETE_FROM_RECYCLE_BIN = 40
    """Client: Delete objects from the recycle bin."""
    CLIENT_OPEN_PROPERTIES = 44
    """Client: Open object properties."""
    CLIENT_DEBUG_EVENTS = 45
    """Client: Debug events."""
    CLIENT_CREATE_EVENTS = 49
    """Client: Create events."""
    CLIENT_USE_OBJECT_SEARCH = 51
    """Client: Use object search."""
    CLIENT_USE_NAVIGATION = 52
    """Client: Use navigation."""
    CLIENT_DELETE_ARCHIVED_DOCUMENTS = 53
    """Client: Delete archived documents."""
    CLIENT_MANAGE_FOLLOW_UPS = 55
    """Client: Manage follow-ups."""
    CLIENT_CONFIGURE_HISTORY_FOR_OBJECT = 56
    """Client: Configure history for an individual object."""
    CLIENT_EXECUTE_BATCH_CHANGES = 57
    """Client: Execute changes in batch mode."""
    CLIENT_ADD_ICON = 59
    """Client: Add an icon."""
    CLIENT_DELETE_ICON = 60
    """Client: Delete an icon."""
    CLIENT_MOVE_OBJECTS = 63
    """Client: Move objects."""
    CLIENT_EDIT_STATIC_LAYERS_OF_OTHER_USERS = 64
    """Client: Edit static layers of other users."""
    CLIENT_OPEN_NOTES = 71
    """Client: Open notes."""
    CLIENT_ALWAYS_SHOW_VARIANT_ADMINISTRATION = 73
    """Client: Always show the variant administration panel."""
    CLIENT_PRINT_DOCUMENTS = 74
    """Client: Print documents."""
    CLIENT_CHANGE_ARCHIVING_STATUS = 75
    """Client: Change the archiving status of documents."""
    CLIENT_SHOW_FAVORITES = 76
    """Client: Show favorites."""
    CLIENT_CUSTOMIZE_RIBBON = 77
    """Client: Customize the ribbon."""
    CLIENT_RUN_DEFAULT_SEARCH = 78
    """Client: Run the default search."""
    CLIENT_MOVE_ACROSS_CABINETS = 79
    """Client: Move objects across cabinets."""
    CLIENT_CONFIGURE_EXTERNAL_APPLICATIONS = 80
    """Client: Configure external applications."""
    CLIENT_VIEW_PREVIEW_ANNOTATIONS = 81
    """Client: View preview annotations."""
    CLIENT_EDIT_PREVIEW_ANNOTATIONS = 82
    """Client: Edit preview annotations."""
    CLIENT_ASSIGN_FURTHER_LOCATIONS = 83
    """Client: Assign additional filing locations."""
    CLIENT_CREATE_REFERENCE_DOCUMENTS = 84
    """Client: Create reference (link) documents."""
    CLIENT_SHARE_DOCUMENTS = 85
    """Client: Share documents."""
    CLIENT_MANAGE_SHARING = 86
    """Client: Manage sharing options."""
    CLIENT_CLIENTS = 89
    """Client: Manage client connections."""
    CLIENT_FOLLOW_UPS_FOR_OTHERS = 91
    """Client: Manage follow-ups for other users."""
    CLIENT_SUBSCRIPTIONS_FOR_OTHERS = 92
    """Client: Manage subscriptions for other users."""
    CLIENT_MANAGE_PUBLIC_DESKTOP = 93
    """Client: Manage the public desktop."""
    CLIENT_SCAN_DOCUMENTS = 94
    """Client: Scan documents."""
    CLIENT_SHOW_OBJECT_COUNT_IN_REGISTER_TREE = 95
    """Client: Show the number of objects in the register tree."""
    CLIENT_EXPORT_INDEX_DATA = 97
    """Client: Export index data."""
    CLIENT_UNDO_CHECKOUT_FOR_OTHERS = 98
    """Client: Undo the checkout for other users."""
    CLIENT_OPEN_LINKS = 99
    """Client: Open links."""
    CLIENT_EDIT_LINKS = 100
    """Client: Edit links."""
    CLIENT_COPY_ACROSS_CABINETS = 102
    """Client: Copy objects across cabinets."""
    CLIENT_USE_SUBSCRIPTIONS = 110
    """Client: Use subscriptions."""
    CLIENT_USE_FOLLOW_UPS = 111
    """Client: Use follow-ups."""
    CLIENT_SIGN_DOCUMENTS = 112
    """Client: Sign documents."""

    # ── WebClient ─────────────────────────────────────────────────────────────
    WEBCLIENT_START = 70
    """WebClient: Start the web client."""
    WEBCLIENT_OPEN_LOCATION = 101
    """WebClient: Open a location."""
    WEBCLIENT_USE_SAVED_SEARCHES = 103
    """WebClient: Use saved searches."""
    WEBCLIENT_USE_OBJECT_REFERENCES = 104
    """WebClient: Use object references."""
    WEBCLIENT_USE_SUBSCRIPTIONS = 105
    """WebClient: Use subscriptions."""
    WEBCLIENT_USE_FOLLOW_UPS = 106
    """WebClient: Use follow-ups."""
    WEBCLIENT_SHOW_HISTORY = 107
    """WebClient: Show history."""

    # ── Workflow ──────────────────────────────────────────────────────────────
    CLIENT_USE_WORKFLOW = 19
    """Client: Use workflow."""
    WF_ADMIN_START = 20
    """WF-Admin: Start the workflow administrator."""
    WF_EDITOR_START = 21
    """WF-Editor: Start the workflow editor."""
    WF_EDITOR_EDIT_ORGANIZATION = 22
    """WF-Editor: Edit the organization structure."""
    WF_EDITOR_CREATE_MODEL = 23
    """WF-Editor: Create a workflow model."""
    WF_PROCESSES_START_VIA_IMPORT = 24
    """WF-Processes: Start processes via import."""
    WF_SIMULATION_START = 25
    """WF-Simulation: Start the workflow simulation."""
    WF_SCRIPT_START = 26
    """WF-Script: Start the workflow script engine."""
    WF_EDITOR_REPORT_USER_PRESENCE = 58
    """WF-Editor: Report presence or absence of users."""
    CLIENT_CONFIGURE_WORKFLOW_SUBSTITUTES = 61
    """Client: Configure workflow substitutes."""
    CLIENT_WORKFLOW_PROCESS_ADMINISTRATION = 62
    """Client: Administer workflow processes."""
    CLIENT_EDIT_WORKFLOW_CIRCULATION_SLIP = 67
    """Client: Edit the workflow circulation slip."""
    CLIENT_MANAGE_PRIVATE_CIRCULATION_SLIP_TEMPLATES = 68
    """Client: Manage private circulation slip templates for workflows."""
    CLIENT_MANAGE_PUBLIC_CIRCULATION_SLIP_TEMPLATES = 69
    """Client: Manage public circulation slip templates for workflows."""
    CLIENT_SHOW_WORKFLOW_SUBSTITUTIONS = 90
    """Client: Show workflow substitutions."""
    WF_MANAGE_ABSENCES = 108
    """Workflow: Manage user absences."""

    # ── Enterprise Manager ────────────────────────────────────────────────────
    ENTERPRISE_MANAGER_START = 27
    """Enterprise-Manager: Start the Enterprise Manager."""

    # ── Server ────────────────────────────────────────────────────────────────
    SERVER_SWITCH_JOB_CONTEXT = 72
    """Server: Switch the job context."""
    SERVER_EXECUTE_ADO_JOBS = 88
    """Server: Execute ADO jobs."""
    SERVER_EXECUTE_SCRIPTS = 109
    """Server: Execute scripts."""

    # ── Unknown ───────────────────────────────────────────────────────────────
    UNKNOWN_3 = 3
    """Undocumented role ID 3."""
    UNKNOWN_7 = 7
    """Undocumented role ID 7."""
    UNKNOWN_41 = 41
    """Undocumented role ID 41."""
    UNKNOWN_42 = 42
    """Undocumented role ID 42."""
    UNKNOWN_43 = 43
    """Undocumented role ID 43."""
    UNKNOWN_46 = 46
    """Undocumented role ID 46."""
    UNKNOWN_47 = 47
    """Undocumented role ID 47."""
    UNKNOWN_48 = 48
    """Undocumented role ID 48."""
