<?php

/**
 * Copyright 2024-2025 Simply.IN Sp. z o.o.
 *
 * NOTICE OF LICENSE
 *
 * Licensed under the EUPL-1.2 or later.
 * You may not use this work except in compliance with the Licence.
 *
 * Copy of the Licence is available at:
 * https://joinup.ec.europa.eu/software/page/eupl
 * It is bundled with this package in the file LICENSE.txt
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the Licence is distributed on an as is basis,
 * without warranties or conditions of any kind, either express or implied.
 * Check the Licence for the specific language governing permissions
 * and limitations under the License.
 *
 * @author   Simply.IN Sp. z o.o.
 * @copyright 2024-2025 Simply.IN Sp. z o.o.
 * @license   https://joinup.ec.europa.eu/software/page/eupl
 */

declare(strict_types=1);

namespace SimplyIn\Session;

if (!defined('_PS_VERSION_')) {
    exit;
}

enum SessionKey: string
{
    case AUTH_TOKEN = 'simplyin_auth_token';
    case EMAIL = 'simplyin_email';
    case REFRESH_TOKEN = 'simplyin_refresh_token';

    case NOTIFIACTION_TOKEN_ID = 'simplyin_notifiaction_token_id';

    case PAYMENT_TYPE = 'simplyin_payment_type';
    case PAYMENT_ID = 'simplyin_payment_id';
    case PAYMENT_PROVIDER = 'simplyin_payment_provider';
    case PAYMENT_IMAGE = 'simplyin_payment_image';
    case PAYMENT_LOGO = 'simplyin_payment_logo';
    case PAYMENT_BLIK = 'simplyin_payment_blik';

    case CARD_NAME = 'simplyin_card_name';
    case CARD_LAST_DIGITS = 'simplyin_card_last_digits';
    case CARD_PROVIDER = 'simplyin_card_provider';
    case CARD_OTT = 'simplyin_card_ott';
    case CARD_SAVE = 'simplyin_card_save';

    case ID_ADDRESS_DELIVERY = 'simplyin_id_address_delivery';
    case ID_ADDRESS_INVOICE = 'simplyin_id_address_invoice';
    case BILLING = 'simplyin_billing';
    case SHIPPING = 'simplyin_shipping';
    case PARCEL = 'simplyin_parcel';
    case SERVICE_TYPE = 'service_type';
    case NEW_ACCOUNT_PHONE = 'new_account_phone';

    case PAYMENT_METHODS_CACHE = 'simplyin_pm_cache';

    case CHECKOUT_ADDRESS = 'checkout_address';
    case CHECKOUT_DELIVERY = 'checkout_delivery';
    case CHECKOUT_PARCEL_LOCKER = 'checkout_parcel_locker';
    case CHECKOUT_VERIFICATION_CODE = 'checkout_verification_code';
    case CHECKOUT_USER_DATA = 'checkout_user_data';

    public function backend(): SessionBackend
    {
        return match ($this) {

            self::NEW_ACCOUNT_PHONE => SessionBackend::COOKIE,
            default => SessionBackend::PHP_SESSION,
        };
    }
}
