# ---- App ----
NODE_ENV=development
PORT=4000
APP_URL=http://localhost:5500
APP_TIMEZONE=Africa/Lagos
# Pilot/stakeholder demo in production: allows demo data, Monnify mock/sandbox and on-screen OTPs.
# NEVER true for real customers.
DEMO_MODE=false
# Long random string. Generate one with:
#   node -e "console.log(require('crypto').randomBytes(48).toString('base64url'))"
JWT_SECRET=qlRFQLG7c4xlbZ_Sj8HNN_Oug-Yusa8J8SL4d58p56NHrYwB--fNGJyC879kqcrI
# Encrypts a customer's BVN/NIN only while their Monnify account is pending (wiped once created),
# so a failed account creation can be retried. Required in production; must differ from JWT_SECRET.
# Generate the same way as JWT_SECRET. Changing it means pending retries need the BVN/NIN re-entered.
KYC_ENCRYPTION_KEY=OWL2ktlYlhDQQ_znyQj82AZ6H9mFQQb0yIMGXVRCKijx1k-S1i2RjoBbBkvDlWUO


# ---- MySQL / MariaDB (XAMPP & WAMP default: root with empty password) ----
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=root
DB_PASSWORD=
DB_NAME=nexgen_energy
# Shared hosts often cap connections per user (10-25); stay below it
DB_CONNECTION_LIMIT=10
# true if your MySQL host requires TLS
DB_SSL=false

#DB_PORT=3306
#DB_HOST=176.9.30.198
#DB_NAME=mmsrehab_nextgen_energy
#DB_USER=mmsrehab_Nextgen_User	
#DB_PASSWORD=Mmsrehab_Nextgen_User

# ---- Startup tasks ----
# Apply pending migrations on startup (idempotent)
AUTO_MIGRATE=true
# Creates the first admin on startup if no admin exists (min 10 chars). Remove after first boot.
BOOTSTRAP_ADMIN_EMAIL=
BOOTSTRAP_ADMIN_PASSWORD=
BOOTSTRAP_ADMIN_NAME=Admin
# Pilot only (requires DEMO_MODE=true): load demo data when the database is empty
DEMO_SEED_ON_EMPTY=false

# ---- Payments ----
# Who issues new customers' account numbers and runs the customer portal's checkout:
# paystack (default) | monnify. Account numbers the other gateway already issued keep working.
PAYMENT_PROVIDER=paystack

# ---- Paystack ----
# Your secret key from Dashboard > Settings > API Keys & Webhooks (sk_test_… or sk_live_…).
# Without it Paystack runs in mock mode (no network calls; fake account numbers, instant checkouts).
PAYSTACK_SECRET_KEY=897
# Optional: mock | test | live (default: from the key's prefix)
PAYSTACK_MODE=test
# Bank for dedicated account numbers: test-bank (test mode default), titan-paystack (live default) or wema-bank
PAYSTACK_PREFERRED_BANK=test-bank
# true if Paystack must verify customers before issuing account numbers (businesses in financial
# services, general services or betting). Onboarding then collects the customer's BVN and own bank account.
PAYSTACK_VERIFY_CUSTOMERS=false
PAYSTACK_PLACEHOLDER_EMAIL_DOMAIN=customers.nexgenenergy.ng

# ---- Monnify ----
# mock = no network calls (dev without keys) | sandbox | live
# Leave MONNIFY_MODE empty to auto-pick: sandbox when the three keys below are set, otherwise mock.
MONNIFY_MODE=sandbox
MONNIFY_API_KEY=MK_TEST_ZG4X0BFSVS
MONNIFY_SECRET_KEY=ZRMK8GYKLRMQM7BVKT8N1BGVAXE6X6VU
MONNIFY_CONTRACT_CODE=0449557532

# Aliyu
#MONNIFY_API_KEY=MK_TEST_VB9DFRL2TV
#MONNIFY_SECRET_KEY=VXRNR9EN4TV7RJFD6NQTZFDN471BU500
#MONNIFY_CONTRACT_CODE=3264016503
# Optional: comma-separated bank codes for reserved accounts, e.g. 50515 (Moniepoint) or 035 (Wema)
MONNIFY_PREFERRED_BANKS=50515,035
MONNIFY_PLACEHOLDER_EMAIL_DOMAIN=customers.nexgenenergy.ng

# Automatic retry of Monnify account creation after temporary outages (on by default)
ACCOUNT_RETRY_JOB=true
ACCOUNT_RETRY_INTERVAL_SECONDS=60

# ---- Payment plans ----
# Longest repayment plan offered, in months (1–24; 24 = two years, the maximum)
PLAN_MAX_MONTHS=24
# Smallest installment allowed, in naira (plans whose installment would be lower are refused)
PLAN_MIN_INSTALLMENT=100

# ---- SMS for customer OTP ----
# console = print OTP codes in the API log (dev) | termii
SMS_PROVIDER=console
TERMII_API_KEY=
TERMII_SENDER_ID=Nexgen
TERMII_BASE_URL=https://api.ng.termii.com

# ---- Email for customer login codes (sent together with the SMS) ----
# console = print emails in the API log (dev) | cpanel = your cPanel mailbox | smtp = any SMTP server
# none = email off (SMS only). Default: console in development, none in production.
SMTP_SERVICE=console
# cPanel > Email Accounts > Connect Devices shows these. Usually mail.<your-domain>, port 465 (SSL).
SMTP_HOST=mail.nexgenenergy.ng
SMTP_PORT=465
# true for 465 (SSL); false for 587 (STARTTLS). Leave empty to decide from the port.
SMTP_SECURE=
# The full mailbox address and its password (the mailbox you created in cPanel)
SMTP_USER=no-reply@nexgenenergy.ng
SMTP_PASS=
# Sender shown to customers; must be the same mailbox (or an alias of it) on cPanel
SMTP_FROM="Nexgen Energy <no-reply@nexgenenergy.ng>"
# Set false only if the server's certificate doesn't match SMTP_HOST (some shared hosts)
SMTP_TLS_REJECT_UNAUTHORIZED=true

# ---- Payment reminders to customers (SMS, plus email when they have one) ----
# Off by default because every reminder is an SMS you pay for. Turn on once SMS is set up.
REMINDERS_ENABLED=false
# Earliest hour to send (Africa/Lagos, 6-19); nothing goes out after 8 pm
REMINDER_HOUR=8
# due_tomorrow, due_today, missed (day after), overdue (every 7 days while overdue)
REMINDER_KINDS=due_tomorrow,due_today,missed,overdue

# ---- Customer documents (photos, ID documents, guarantor files) ----
# Always encrypted with KYC_ENCRYPTION_KEY. database = stored in MySQL (default: included in your
# database backups, works on Render) | local = files on disk under FILE_STORAGE_DIR (back that folder up too)
FILE_STORAGE=database
FILE_STORAGE_DIR=
# Largest upload in MB (photos are compressed in the browser first, so they're usually ~300 KB)
UPLOAD_MAX_MB=5

# ---- Demo seed credentials (dev only; used by `npm run db:seed`) ----
SEED_ADMIN_EMAIL=admin@nexgenenergy.ng
SEED_ADMIN_PASSWORD=Admin@12345
SEED_AGENT_PASSWORD=Agent@12345

# ---- Docker (only for the compose.yaml setup; see deploy/DOCKER.md) ----
# Root password of the MySQL container. The app user DB_USER/DB_PASSWORD is created automatically.
MYSQL_ROOT_PASSWORD=
# Pull CI-built images (e.g. ghcr.io/<owner>/nexgen-energy) instead of building on the server
APP_IMAGE=
