/**
 * Feature flags and environment configuration
 * Controls feature availability and environment settings based on build mode (production, beta, development)
 */

interface FeatureConfig {
    // Registration features
    enableAttorneyRegistration: boolean;
    enableRealEstateAgentRegistration: boolean;
    enableRegistration: boolean;

    // UI Features
    enableFloatingChatButton: boolean;
    enableMLSPublishing: boolean;

    // API Configuration
    apiUrl: string;

    // Data Configuration
    useLiveData: boolean;
}

/**
 * Get feature configuration based on current environment
 */
const getFeatureConfig = (): FeatureConfig => {
    const mode = import.meta.env.MODE || 'development';

    // Production configuration
    if (mode === 'production') {
        return {
            enableAttorneyRegistration: false,
            enableRealEstateAgentRegistration: false,
            enableRegistration: false,
            enableFloatingChatButton: false,
            enableMLSPublishing: false,
            apiUrl: 'https://backend.ditchtheagent.com/api/',
            useLiveData: true,
        };
    }

    // Beta configuration
    if (mode === 'beta') {
        return {
            enableAttorneyRegistration: true,
            enableRealEstateAgentRegistration: true,
            enableRegistration: true,
            enableFloatingChatButton: true,
            enableMLSPublishing: true,
            apiUrl: 'https://beta.backend.ditchtheagent.com/api/',
            useLiveData: true,
        };
    }

    // Development configuration (default)
    return {
        enableAttorneyRegistration: true,
        enableRealEstateAgentRegistration: true,
        enableRegistration: true,
        enableFloatingChatButton: true,
        enableMLSPublishing: true,
        apiUrl: 'http://127.0.0.1:8010/api/',
        useLiveData: false,
    };
};

export const features = getFeatureConfig();
