<?php

namespace App\Core;

/**
 * Application Constants
 * جميع القيم الثابتة في مكان واحد
 */
class Constants
{
    // Pagination
    const DEFAULT_PER_PAGE = 25;
    const MAX_PER_PAGE = 100;
    const MIN_PER_PAGE = 10;

    // Search Limits
    const SEARCH_PATIENTS_LIMIT = 15;
    const SEARCH_ORDERS_LIMIT = 15;
    const SEARCH_DOCTORS_LIMIT = 10;
    const SEARCH_MAX_RESULTS = 50;

    // File Upload
    const MAX_FILE_SIZE = 5242880; // 5MB
    const MAX_IMAGE_SIZE = 2097152; // 2MB
    const ALLOWED_IMAGE_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'];
    const ALLOWED_DOCUMENT_TYPES = ['application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'];

    // Cache TTL
    const CACHE_TTL_SHORT = 300; // 5 minutes
    const CACHE_TTL_MEDIUM = 1800; // 30 minutes
    const CACHE_TTL_LONG = 3600; // 1 hour
    const CACHE_TTL_DAY = 86400; // 24 hours

    // Session
    const SESSION_LIFETIME_DEFAULT = 1800; // 30 minutes
    const SESSION_LIFETIME_REMEMBER = 2592000; // 30 days

    // Rate Limiting
    const RATE_LIMIT_LOGIN_ATTEMPTS = 5;
    const RATE_LIMIT_LOGIN_WINDOW = 900; // 15 minutes
    const RATE_LIMIT_API_ATTEMPTS = 100;
    const RATE_LIMIT_API_WINDOW = 3600; // 1 hour

    // Password
    const PASSWORD_MIN_LENGTH = 8;
    const PASSWORD_MAX_LENGTH = 128;

    // Order Status
    const ORDER_STATUS_PENDING = 'pending';
    const ORDER_STATUS_IN_PROGRESS = 'in_progress';
    const ORDER_STATUS_COMPLETED = 'completed';
    const ORDER_STATUS_CANCELLED = 'cancelled';

    // Payment Status
    const PAYMENT_STATUS_UNPAID = 'unpaid';
    const PAYMENT_STATUS_PARTIAL = 'partial';
    const PAYMENT_STATUS_PAID = 'paid';

    // Result Flags
    const RESULT_FLAG_NORMAL = 'N';
    const RESULT_FLAG_LOW = 'L';
    const RESULT_FLAG_HIGH = 'H';
    const RESULT_FLAG_CRITICAL = 'C';

    // Date Formats
    const DATE_FORMAT = 'Y-m-d';
    const DATETIME_FORMAT = 'Y-m-d H:i:s';
    const TIME_FORMAT = 'H:i:s';

    // Currency
    const CURRENCY_IQD = 'IQD';
    const CURRENCY_USD = 'USD';
    const DEFAULT_CURRENCY = 'IQD';

    // Export Limits
    const EXPORT_MAX_ROWS = 10000;
    const EXPORT_CSV_DELIMITER = ',';
    const EXPORT_CSV_ENCLOSURE = '"';

    // Notification Types
    const NOTIFICATION_TYPE_INFO = 'info';
    const NOTIFICATION_TYPE_SUCCESS = 'success';
    const NOTIFICATION_TYPE_WARNING = 'warning';
    const NOTIFICATION_TYPE_ERROR = 'error';

    // Job Queue
    const JOB_MAX_RETRIES = 3;
    const JOB_RETRY_DELAY = 60; // seconds
    const JOB_PROCESS_LIMIT = 50;

    // Backup
    const BACKUP_RETENTION_DAYS = 7;
    const BACKUP_MAX_SIZE = 1073741824; // 1GB

    // Performance
    const SLOW_QUERY_THRESHOLD = 1.0; // seconds
    const SLOW_REQUEST_THRESHOLD = 2.0; // seconds

    // Validation
    const PHONE_MIN_LENGTH = 7;
    const PHONE_MAX_LENGTH = 15;
    const NAME_MIN_LENGTH = 2;
    const NAME_MAX_LENGTH = 255;
    const EMAIL_MAX_LENGTH = 255;
}
