<?php
/**
 * DESCRIPTION: Defines constants for booking statuses, payment statuses, and event type keys
 * used throughout the plugin to avoid magic strings.
 *
 * @package NemtlyBooking
 * @since   PBOOKING_SINCE
 */

namespace NemtlyBooking\Core;

/**
 * Status constants for bookings, payments, and event types
 *
 * Centralizes all status strings so they can be referenced consistently
 * and refactored safely. These values correspond to database column values
 * and REST API enum values — changing them requires a migration.
 *
 * @since PBOOKING_SINCE
 */
class Status {

    // -- Booking statuses (stored in nemtly_bookings.booking_status) --

    public const BOOKING_PENDING    = 'pending';
    public const BOOKING_CONFIRMED  = 'confirmed';
    public const BOOKING_CANCELLED  = 'cancelled';
    public const BOOKING_REJECTED   = 'rejected';
    public const BOOKING_WAITLISTED = 'waitlisted';

    /**
     * All valid booking statuses
     *
     * @since PBOOKING_SINCE
     *
     * @return string[]
     */
    public static function booking_statuses(): array {
        return [
            self::BOOKING_PENDING,
            self::BOOKING_CONFIRMED,
            self::BOOKING_CANCELLED,
            self::BOOKING_REJECTED,
            self::BOOKING_WAITLISTED,
        ];
    }

    // -- Payment statuses (stored in nemtly_payments.payment_status) --

    public const PAYMENT_PENDING    = 'pending';
    public const PAYMENT_SUCCEEDED  = 'succeeded';
    public const PAYMENT_COMPLETED  = 'completed';
    public const PAYMENT_FAILED     = 'failed';
    public const PAYMENT_REFUNDED   = 'refunded';
    public const PAYMENT_PROCESSING = 'processing';

    /**
     * All valid payment statuses
     *
     * @since PBOOKING_SINCE
     *
     * @return string[]
     */
    public static function payment_statuses(): array {
        return [
            self::PAYMENT_PENDING,
            self::PAYMENT_SUCCEEDED,
            self::PAYMENT_COMPLETED,
            self::PAYMENT_FAILED,
            self::PAYMENT_REFUNDED,
            self::PAYMENT_PROCESSING,
        ];
    }

    // -- Default event type keys (stored in postmeta nemtly_event_type) --

    public const EVENT_TYPE_ONE_ON_ONE = 'one-on-one';
    public const EVENT_TYPE_GROUP      = 'group';
    public const EVENT_TYPE_EVENT      = 'event';

    /**
     * All default event type keys
     *
     * @since PBOOKING_SINCE
     *
     * @return string[]
     */
    public static function default_event_types(): array {
        return [
            self::EVENT_TYPE_ONE_ON_ONE,
            self::EVENT_TYPE_GROUP,
            self::EVENT_TYPE_EVENT,
        ];
    }
}
