<?php
/**
 * Landing page configuration — paths and church details.
 */

if (!defined('LANDING_ROOT')) {
    define('LANDING_ROOT', __DIR__);
}

$parentApp = dirname(LANDING_ROOT) . '/config/app.php';
if (is_file($parentApp)) {
    require_once $parentApp;
}

if (!defined('SITE_NAME')) {
    define('SITE_NAME', 'Nazareth');
}
if (!defined('SITE_FULL_NAME')) {
    define('SITE_FULL_NAME', 'Presbyterian Church of Ghana, Nazareth Congregation, La');
}
if (!defined('MOTTO')) {
    define('MOTTO', 'That They All May Be One');
}

$landingScript = str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'] ?? '/landing'));
define('LANDING_BASE', ($landingScript === '/' || $landingScript === '.') ? '/landing' : $landingScript);

$appBase = dirname(LANDING_BASE);
define('APP_BASE', ($appBase === '/' || $appBase === '.') ? '' : $appBase);

function landing_asset(string $path): string
{
    return LANDING_BASE . '/assets/' . ltrim($path, '/');
}

function landing_img(string $path): string
{
    return APP_BASE . '/public/img/' . ltrim($path, '/');
}

function landing_login_url(): string
{
    if (function_exists('nazareth_url')) {
        return nazareth_url('login');
    }
    $base = APP_BASE;
    if (defined('NAZARETH_USE_INDEX_ROUTES') && NAZARETH_USE_INDEX_ROUTES) {
        return $base . '/index.php?route=login';
    }
    return $base . '/login';
}

// Editable contact & service info (update for go-live)
define('LANDING_PHONE', '+233 XX XXX XXXX');
define('LANDING_EMAIL', 'info@naz-pcg.org');
define('LANDING_ADDRESS', 'La, Accra, Ghana');
define('LANDING_MAP_URL', 'https://maps.google.com/?q=La+Accra+Ghana');
