<?php
header("Content-Type: application/json");

include "./../setup/connect_db.php";
include "./../lib/send_reply_json.php";
include "./../lib/maestro_account_info.php";
include "./../lib/db_maestro.php";
include "./mail_setting.php";
include "./send_mail.php";

$type = $_POST["type"];
$maestro_id = $_POST["maestro_id"];
$maestro_name = $_POST["maestro_name"];
$password = $_POST["password"];
$available_date = $_POST["available_date"];
$new_available_date = $_POST["new_available_date"];
$maestro_email = $_POST["email"];
$account_type = $_POST["account_type"];
$upgrade_account_type = $_POST["upgrade_account_type"];
$registered_account_type = $_POST["registered_account_type"];
$maestro_name_prev = $_POST["maestro_name_prev"];
$maestro_email_prev = $_POST["email_prev"];


if($type == "sendMailRegisterBankInfo") {
	sendMailRegisterBankInfo($maestro_name, $maestro_email, $account_type);
} else if($type == "sendMailRegistered") {
	sendMailRegisterDone($maestro_name, $maestro_email);
} else if($type == "sendMailUpgradeBankInfo") {
	sendMailUpgradeBankInfo($maestro_name, $maestro_email, $account_type, $upgrade_account_type);
} else if($type == "sendMailUpgradeDone") {
	sendMailUpgradeDone($maestro_name, $maestro_email, $account_type, $upgrade_account_type);
} else if($type == "sendMailUpdateMaestroName") {
	sendMailUpdateMaestroName($maestro_name, $maestro_name_prev, $maestro_email);
} else if($type == "sendMailUpdateMaestroEmail") {
	sendMailUpdateMaestroEmail($maestro_name, $maestro_email, $maestro_email_prev);
} else if($type == "sendMailExtensionBankInfo") {
	sendMailExtensionBankInfo($maestro_name, $available_date, $new_available_date, $maestro_email, $registered_account_type);
} else if($type == "sendMailExtensionDone") {
	sendMailExtensionDone($maestro_name, $new_available_date, $maestro_email);
} else if($type == "get_maestro_data") {
	// maestro data
	$maestro_data = get_maestro_data($maestro_id);
	set_data("maestroData", $maestro_data);
}

send_result_success();

exit;

?>