from parallels.core.utils.message_utils import single_line_message, multi_line_message

ACTION_READ_MIGRATION_LIST_DESCRIPTION = single_line_message("""
    Read mail migration list
""")
ACTION_READ_MIGRATION_LIST_FAILURE = single_line_message("""
    Failed to read mail migration list
""")
ACTION_DEPLOY_MAILBOXES_DESCRIPTION = single_line_message("""
    Create destination mailbox
""")
FAILED_TO_ENABLE_MAILBOX = single_line_message("""
    Failed to enable mailbox for the destination e-mail. 
    Try enabling mailbox using the Plesk user interface and then retry mail import.
""")
CREATE_MAILNAME = single_line_message("""
    Mailname does not exists on the server, create
""")
INVALID_READ_MAIL_MIGRATION_LIST_OUTPUT = single_line_message("""
    Invalid output was returned by read mail migration list script (read-mail-migration-list.php). 
    Expected to have "MAIL-MIGRATION-LIST>>>" and "<<<MAIL-MIGRATION-LIST" strings 
    with mail migration list contents between in script's output. Check that the script is not broken.
""")
MAILBOX_EXISTS_GET_PASSWORD = single_line_message("""
    Mailname with mailbox exists on the server, retrieve its password
""")
MAILBOX_EXISTS_DO_NOTHING = single_line_message("""
    Mailname with mailbox already exists on the server
""")
MAILNAME_WITHOUT_MAILBOX = single_line_message("""
    Mailname exists, but it has disabled mailbox: enable mailbox for the mailname
""")
ACTION_DEPLOY_MAILBOXES_FAILURE = single_line_message("""
    Could not create a new target mailbox. Try creating a mailbox using the Plesk user interface, 
    and then importing into the new mailbox.
""")
ACTION_COPY_MAIL_MESSAGES_DESCRIPTION = single_line_message("""
    Connect to the source server and copy mail messages
""")
ACTION_COPY_MAIL_MESSAGES_FAILURE = single_line_message("""
    Failed to connect to the source server and copy mail messages
""")
ACTION_REFRESH_DISK_USAGE_DESCRIPTION = single_line_message("""
    Refresh disk usage stats
""")
ACTION_REFRESH_DISK_USAGE_FAILURE = single_line_message("""
    Failed to refresh disk usage stats
""")
MAIL_MIGRATION_LIST_OPTION = single_line_message("""
    Mail migration list - JSON file which contains information about mailboxes to be transferred
""")
TASK_ID_OPTION = single_line_message("""
    ID of the task in scope of which the current command is running
""")
TASK_STATUS_OPTION = single_line_message("""
    File to write task status in JSON format
""")
ASYNC_STATUS_REPORT_OPTION = single_line_message("""
    Controls how status information is reported to status file. If the option is set then
    new mailbox is added to list of mailboxes immediately, and all issues are appended to the list of
    issues. Otherwise, when the option is not set, new mailbox is added to the list of mailboxes
    only when actual transfer of mail messages started, issues are appended to the list of issues
    only when actual transfer of mail messages started (before that moment, .
""")
COMMAND_TRANSFER_MAIL = single_line_message("""
    Transfer mail
""")
COMMAND_RUN_TASKS = single_line_message("""
    Run mail migration tasks
""")
COMMAND_ADD_TASKS = single_line_message("""
    Add mail migration tasks
""")
COMMAND_CANCEL_TASKS = single_line_message("""
    Cancel mail migration tasks
""")
INVALID_EMAIL_ADDRESS = single_line_message("""
    Invalid e-mail address: {address}
""")
MAIL_ADDRESS_PAIR_OBJECT_DESCRIPTION = single_line_message("""
    mail transfer from '{source_email}' to '{target_email}'
""")
ACTION_WRITE_INITIAL_STATUS_DESCRIPTION = single_line_message("""
    Initialize migration status files
""")
ACTION_WRITE_INITIAL_STATUS_FAILURE = single_line_message("""
    Failed to initialize migration status files
""")
ACTION_CANCEL_TASKS_DESCRIPTION = single_line_message("""
    Cancel mail migration tasks
""")
ACTION_CANCEL_TASKS_FAILURE = single_line_message("""
    Failed to cancel mail migration tasks
""")
STOP_RUNNING_TASK = single_line_message("""
    Requested to stop running task '{task_id}', waiting
""")
TASK_STOPPED = single_line_message("""
    Task '{task_id}' was stopped
""")
TASK_CANCELLED = single_line_message("""
    Task '{task_id}' was cancelled
""")
ACTION_RETRIEVE_TARGET_SITE_INFO_DESCRIPTION = single_line_message("""
    Retrieve information about target site
""")
ACTION_RETRIEVE_TARGET_SITE_INFO_FAILURE = single_line_message("""
    Failed to retrieve information about target site
""")
NO_DOMAIN_ON_TARGET = single_line_message("""
    Domain '{domain_name}' specified in configuration file does not exist on the target server
""")
TARGET_SUBDOMAIN_ERROR = single_line_message("""
    Subdomain '{domain_name}' was specified in configuration file, but subdomains can not have mail service
""")
INVALID_TARGET_MAILNAME = single_line_message("""
    Invalid target mailname '{mailname}' was specified
""")
MIGRATION_LOG_PATH = single_line_message("""
    Mail migrator migration log will be put to '{path}'
""")
BACKUP_LOG_PATH = single_line_message("""
    Mail migrator backup log will be put to '{path}'
""")
RESTORE_LOG_PATH = single_line_message("""
    Mail migrator restore log will be put to '{path}'
""")
LIST_MESSAGE_IDS_LOG_PATH = single_line_message("""
    Mail migrator list message IDs log will be put to '{path}'
""")
FAILED_TO_BACKUP_MAIL_MESSAGES = single_line_message("""
    Failed to backup mail messages
""")
FAILED_TO_BACKUP_MAIL_MESSAGES_DETAILS = multi_line_message("""
    Backup command: {command}
    Exit code of backup command: {exit_code}
    Stderr of backup command:
    {stderr}
""")
FAILED_TO_RESTORE_MAIL_MESSAGES = single_line_message("""
    Failed to restore mail messages
""")
FAILED_TO_RESTORE_MAIL_MESSAGES_DETAILS = multi_line_message("""
    Restore command: {command}
    Exit code of restore command: {exit_code}
    Stderr of restore command:
    {stderr}
""")
ACTION_WRITE_FINAL_STATUS_DESCRIPTION = single_line_message("""
    Write final import status to a file
""")
ACTION_WRITE_FINAL_STATUS_FAILURE = single_line_message("""
    Failed to write final import status to a file
""")
ACTION_ADD_TASKS_DESCRIPTION = single_line_message("""
    Add mail migration tasks for specified mail address pairs
""")
ACTION_ADD_TASKS_FAILURE = single_line_message("""
    Failed to add mail migration tasks for specified mail address pairs
""")
SCHEDULED_TASK = multi_line_message("""
    Scheduled task '{task_id}'
    Task directory: {task_dir}
    Migration list:
    {migration_list}
""")
ACTION_RUN_TASKS_DESCRIPTION = single_line_message("""
    Run mail migration tasks
""")
ACTION_RUN_TASKS_FAILURE = single_line_message("""
    Failed to run mail migration tasks
""")
RUN_COMMAND = single_line_message("""
    Run task command: {command}
""")
COMMAND_TERMINATED = single_line_message("""
    Task command process was terminated by stop request
""")
COMMAND_FINISHED = single_line_message("""
    Command execution finished
""")
LOG_EXECUTE_FOR_OBJECT = single_line_message("""
    Execute for {object_description}
""")
LOG_SKIP_EXECUTE_FOR_OBJECT = single_line_message("""
    Skip executing for {object_description} as pre-requirement actions were not executed
""")
ACTION_START_TRANSFER_MAIL_STATISTICS = single_line_message("""
    Start statistics collection
""")
FAILED_ACTION_START_TRANSFER_MAIL_STATISTICS = single_line_message("""
    Failed to start statistics collection
""")
ACTION_FINALIZE_TRANSFER_MAIL_STATISTICS = single_line_message("""
    Finalize statistics for 'transfer mail' action
""")
FAILED_ACTION_FINALIZE_TRANSFER_MAIL_STATISTICS = single_line_message("""
    Failed to finalize statistics for 'transfer mail' action
""")
FAILED_READ_SESSION_FILE = single_line_message("""
    Failed to read session file '{file}': {error}
""")
UNEXPECTED_SESSION_CONTENT = single_line_message("""
    Unexpected session content in file '{file}'. Expected '{expected_type}', got '{got_type}'.
""")
MIGRATION_LIST_EXACTLY_ONE_MAIL_ADDRESS_PAIR = single_line_message("""
    Mail migration list must contain exactly one mail address pair"
""")
FAILED_ACTION_START_COPY_MAIL_STATISTICS = single_line_message("""
    Failed to start copy mail messages statistics collection
""")
FAILED_ACTION_FINISH_COPY_MAIL_STATISTICS = single_line_message("""
    Failed to finish copy mail messages statistics collection
""")
