<?php
require_once 'vendor/autoload.php';
include_once 'utils.php';

class User
{
    public $id;
    public $username;
    public $title;
    public $first_name;
    public $last_name;
    public $organization;
    public $user_hash;
    public $password;
    public $street;
    public $zip;
    public $city;
    public $country;
    public $email;
    public $phone;
    public bool $eula_signed;
    public bool $privacy_policy_signed;
    public bool $author;
    public $accepted_paper_id;
    public bool $participation_confirmed;
    public $participation_confirmed_at;
    public bool $student;
    public bool $conference_dinner;
    public bool $vegetarian_dinner;
    public $registered_at;
    public bool $earlybird_registration;
    public $lunch_day_1;
    public $lunch_day_2;
    public $lunch_day_3;
    public bool $excursion;
    public float $total_due;
    public $invoice;
    public bool $presentation_confirmed;

    function __construct()
    {
        $this->id = "";
        $this->username = "";
        $this->title = "";
        $this->first_name = "";
        $this->last_name = "";
        $this->email = "";
        $this->organization = "";
        $this->user_hash = "";
        $this->password = "";
        $this->city = "";
        $this->country = "";
        $this->zip = "";
        $this->street = "";
        $this->phone = "";
        $this->eula_signed = false;
        $this->privacy_policy_signed = false;
        $this->author = false;
        $this->accepted_paper_id = "";
        $this->participation_confirmed = false;
        $this->participation_confirmed_at = "";
        $this->student = false;
        $this->conference_dinner = false;
        $this->vegetarian_dinner = false;
        $this->registered_at = date("Y-m-d H:i:s") . "UTC";
        $this->earlybird_registration = false;
        $this->lunch_day_1 = "";
        $this->lunch_day_2 = "";
        $this->lunch_day_3 = "";
        $this->excursion = false;
        $this->total_due = 0.0;
        $this->invoice = "";
        $this->presentation_confirmed = false;
    }

    function set_name_and_paper_id($first_name, $last_name, $paper_id): User
    {
        $this->first_name = $first_name;
        $this->last_name = $last_name;
        $this->accepted_paper_id = $paper_id;
        return $this;
    }

    function set_email_and_paper_id($email, $paper_id): User
    {
        $this->email = $email;
        $this->accepted_paper_id = $paper_id;
        return $this;
    }
    function __construct1(object $data)
    {
        foreach ($data as $key => $value) {
            if (array_key_exists($key, (array) $this))
                $this->{$key} = $value;
        }
        if (isset($data->password))
            $this->set_password($data->password);
    }

    function init_from_object(object $data)
    {
        foreach ($data as $key => $value) {
            if (array_key_exists($key, (array) $this))
                $this->{$key} = $value;
        }
        if (isset($data->password))
            $this->set_password($data->password);
    }

    function init_from_array(array $data)
    {
        foreach ($data as $key => $value) {
            if (array_key_exists($key, (array) $this)) {
                if (is_bool(gettype($this->{$key})) && is_string($value))
                    $this->{$key} = !empty($value);
                else
                    $this->{$key} = $value;
            }
        }
        if (!empty($data["password"]))
            $this->set_password($data["password"]);
    }


    function set_password(string $password)
    {
        include 'config.php';
        if ($CONFERENCE_REGISTRATION) {
            $this->password = generateRandomString(32);
            # $this->user_hash = "{SHA}" .  base64_encode(sha1($password, true));
        } else {
            if ($ENCRYPT_PASSWORDS) {
                $this->user_hash = "{crypt}" . crypt($password, '$6$' . generateSalt(10) . '$');
                # $this->user_hash = "{SHA}" .  base64_encode(sha1($password, true));
            } else {
                $this->user_hash = "{CLEAR}" . $password;
            }
            $this->password = $this->user_hash;
        }
    }

    function to_string()
    {
        $tmp_user = $this;
        $tmp_user->invoice = "";
        $tmp_user->password = "***";
        $tmp_user->user_hash = "***";
        return json_encode($tmp_user);
    }

    function backup_in_session()
    {
        global $_SESSION;
        foreach ($this as $key => $value) {
            $_SESSION[$key] = $value;
        }
    }

    function to_table()
    {
        $table = "<table  style='border: 1px solid #e1e4e8; border-collapse: collapse; width: 100%;'>";
        foreach ($this as $key => $value) {
            if ($key != "password" && $key != "user_hash" && !empty($value) && $key != "invoice") {
                if (is_bool($value)) {
                    if ($value)
                        $value = "yes";
                    else
                        $value = "no";
                } elseif (is_float($value)) {
                    $key .= " €";
                    $value = number_format($value, 2, '.', ' ');
                }
                $value = str_replace("\r\n", "<br>", $value);
                $key = str_replace("_", " ", ucfirst($key));
                $table .= " <tr>
  <td style='border: 1px solid #e1e4e8; padding: 6px 13px;'><strong>$key</strong></td>
  <td style='border: 1px solid #e1e4e8; padding: 6px 13px;'>$value</td>
 </tr>\n";
            }
        }
        $table .= "</table>";
        return $table;
    }
}