<?php
// ============================================================
// FILE: includes/config.php — Konfigurasi Utama
// ============================================================

// --- Informasi Toko ---
define('NAMA_TOKO',    'Toko Kusen & Gypsum Budi Jaya');
define('TAGLINE_TOKO', 'Solusi Kusen & Gypsum Terpercaya Sejak 2005');
define('NO_WA_TOKO',   '6281234567890');
define('ALAMAT_TOKO',  'Jl. Cemplang RT.2/RW.6, Cemplang, Cibungbulang, Kabupaten Bogor, Jawa Barat 16630');
define('EMAIL_TOKO',   'info@budijaya.com');
define('GMAPS_EMBED',  'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3966.521260322371!2d106.99531!3d-6.20876!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x0!2zNsKwMTInMTUuNSJTIDEwNsKwNTknNDMuMSJF!5e0!3m2!1sid!2sid!4v1234567890');
define('GMAPS_LINK',   'https://maps.google.com/?q=-6.20876,106.99531');
define('TAHUN_BERDIRI', 2005);

// --- Database ---
define('DB_HOST', 'localhost');
define('DB_NAME', 'budijaya_db2');
define('DB_USER', 'root');
define('DB_PASS', '');

// --- Path ---
define('BASE_URL',    'http://localhost/budijaya_ecommerce2');
define('BASE_PATH',   __DIR__ . '/..');
define('UPLOAD_PATH', BASE_PATH . '/uploads');
define('UPLOAD_URL',  BASE_URL  . '/uploads');

// --- Upload ---
define('MAX_FILE_SIZE',   5 * 1024 * 1024);
define('ALLOWED_IMG',     ['image/jpeg', 'image/png', 'image/webp']);
define('MAX_FOTO_PRODUK', 10);

// ============================================================
// --- Midtrans Payment Gateway ---
// LANGKAH SETUP:
//   1. Daftar di https://dashboard.midtrans.com/register
//   2. Login → Settings → Access Keys
//   3. Copy "Server Key" dan "Client Key" dari tab SANDBOX
//   4. Tempel di bawah ini
//   5. Setelah go-live: ganti ke Production key & ubah IS_PRODUCTION=true
// ============================================================
define('MIDTRANS_SERVER_KEY',    'Mid-server-7dKwRiq3C7YjAgRImU6uVos3');
define('MIDTRANS_CLIENT_KEY',    'Mid-client-p630dwoER6iuKVXA');
define('MIDTRANS_IS_PRODUCTION', false); // Sandbox

// URL otomatis sesuai mode (jangan diubah)
define('MIDTRANS_SNAP_URL', MIDTRANS_IS_PRODUCTION
    ? 'https://app.midtrans.com/snap/snap.js'
    : 'https://app.sandbox.midtrans.com/snap/snap.js'
);
define('MIDTRANS_API_URL', MIDTRANS_IS_PRODUCTION
    ? 'https://api.midtrans.com/snap/v1/transactions'
    : 'https://app.sandbox.midtrans.com/snap/v1/transactions'
);

// --- PHP Settings ---
date_default_timezone_set('Asia/Jakarta');
ini_set('display_errors', 1);
error_reporting(E_ALL);

if (session_status() === PHP_SESSION_NONE) session_start();

// ============================================================
// --- Binderbyte API (Cek Ongkir) ---
// Daftar di: https://binderbyte.com → login → API Key
// Gratis 500 request / 30 hari
// ============================================================
define('BINDERBYTE_API_KEY', 'ebd00bc50702ec693c76d9751c1909737818bad386a3e0fd2d1df49accd9141b');
define('BINDERBYTE_BASE_URL', 'https://api.binderbyte.com');

// Kota asal pengiriman toko (ID lokasi Binderbyte)
// Cari ID di: https://api.binderbyte.com/v1/locations?api_key=KEY&search=KOTAMU
// Format ID: city_32.75 (Bekasi), city_31.71 (Jakarta Pusat), dst.
define('KOTA_ASAL_ID',    'city_32.01'); // Kabupaten Bogor
define('KOTA_ASAL_NAMA',  'Kab. Bogor'); // untuk tampilan saja