package xyz.myachin.saveto.ui.alerts

import android.content.Context
import android.content.DialogInterface
import androidx.appcompat.app.AlertDialog
import xyz.myachin.saveto.R

fun getDebugAlertDialog(
    context: Context,
    listener: DialogInterface.OnClickListener
): AlertDialog.Builder {
    val alert = AlertDialog.Builder(context)
    alert.setTitle("YOU WON!11")
    alert.setMessage(
        "So much of NOTHING!11.\n" +
                "But if you see this without cheats please, notify me about bug\n" +
                "I mean it is debug alert and cannot be shown on correct application usage"
    )
    alert.setPositiveButton("OK", listener)
    alert.create()
    return alert
}

fun getNotAccessToDirectoryAlert(
    context: Context,
    listenerOK: DialogInterface.OnClickListener,
    listenerCancel: DialogInterface.OnClickListener
): AlertDialog.Builder {
    val alert = AlertDialog.Builder(context)
    alert.setTitle(R.string.access_not_got_title)
    alert.setMessage(R.string.access_not_got_message)
    alert.setNegativeButton(R.string.how_about_no, listenerCancel)
    alert.setPositiveButton(R.string.yes_of_cow, listenerOK)
    alert.create()
    return alert
}

fun getInconsistentOnActivityResult(
    context: Context,
    listener: DialogInterface.OnClickListener
): AlertDialog.Builder {
    val alertDialog = AlertDialog.Builder(context)
    alertDialog.setTitle(R.string.directory_was_not_selected)
    alertDialog.setMessage(R.string.directory_not_selected_result_message)
    alertDialog.setPositiveButton("OK", listener)
    alertDialog.create()
    return alertDialog
}

fun getUnexpectedRequestCode(
    context: Context,
    listener: DialogInterface.OnClickListener
): AlertDialog.Builder {
    val alertDialog = AlertDialog.Builder(context)
    alertDialog.setTitle(R.string.unexpected_result_code_title)
    alertDialog.setMessage(R.string.unexpected_result_code_message)
    alertDialog.setPositiveButton("OK", listener)
    alertDialog.create()
    return alertDialog
}