<?php

use CodeIgniter\Router\RouteCollection;

/** @var RouteCollection $routes */
$routes->get('/', 'Home::index');

// Auth customer -- port dari Home::signin()/signup()/signout() (CI3).
// URL dipertahankan sama (home/signin dst.) supaya link/bookmark lama tidak rusak.
$routes->match(['GET', 'POST'], 'home/signin/(:any)', 'Auth::signin/$1');
$routes->match(['GET', 'POST'], 'home/signin', 'Auth::signin');
$routes->match(['GET', 'POST'], 'home/signup/(:any)', 'Auth::signup/$1');
$routes->match(['GET', 'POST'], 'home/signup', 'Auth::signup');
$routes->get('home/signout', 'Auth::signout');

// Halaman statis -- port dari application/config/routes.php (CI3)
$routes->get('sitemap.xml', 'Sitemap::index');
$routes->get('harga', 'Harga::index');
$routes->get('flashsale', 'Flashsale::index');
$routes->get('shop', 'Shop::index');
$routes->get('shop/preorder', 'Shop::preorder');
$routes->get('kategori/(:any)', 'Kategori::index/$1');
$routes->get('page/(:any)', 'Page::index/$1');
$routes->get('blog', 'Blog::index');
$routes->get('blog/(:any)', 'Blog::single/$1');
$routes->get('produk/(:any)', 'Produk::index/$1');
$routes->get('jasa/(:any)', 'Jasa::index/$1');

// PPOB -- halaman kategori saja (lihat catatan di app/Controllers/Ppob.php)
$routes->get('ppob', 'Ppob::index');
$routes->get('ppob/kategori', 'Ppob::kategori');
$routes->get('ppob/data', 'Ppob::data');
$routes->get('ppob/paketvoucher', 'Ppob::paketvoucher');
$routes->get('ppob/masaaktif', 'Ppob::masaaktif');
$routes->get('ppob/pulsa', 'Ppob::pulsa');
$routes->get('ppob/token', 'Ppob::token');
$routes->get('ppob/emoney', 'Ppob::emoney');
$routes->get('ppob/games', 'Ppob::games');
$routes->get('ppob/voucher', 'Ppob::voucher');
$routes->get('ppob/tvprabayar', 'Ppob::tvprabayar');
$routes->get('ppob/paketsms', 'Ppob::paketsms');
$routes->get('ppob/pascabayar/(:any)', 'Ppob::pascabayar/$1');
$routes->get('ppob/transferbank', 'Ppob::transferbank');
$routes->get('ppob/datalistajax/(:num)/(:any)', 'Ppob::datalistajax/$1/$2');
$routes->get('ppob/prabayar/(:num)/(:any)', 'Ppob::prabayar/$1/$2');
$routes->post('ppob/tokenpln', 'Ppob::tokenpln');
$routes->post('ppob/tambahkeranjangppob', 'Ppob::tambahkeranjangppob');
$routes->post('ppob/hapuskeranjangppob', 'Ppob::hapuskeranjangppob');
$routes->get('home/keranjangppob', 'Home::keranjangppob');

// Cekout -- PPOB (saldo) + fisik/jasa (Transfer Manual + Midtrans) (lihat catatan di app/Controllers/Cekout.php)
$routes->post('cekout/bayarpesananppob', 'Cekout::bayarpesananppob');
$routes->post('cekout/bayarpesanan', 'Cekout::bayarpesanan');
$routes->post('cekout/bayarpesananjasa', 'Cekout::bayarpesananjasa');
$routes->post('cekout/midtranstoken', 'Cekout::midtransToken');

// Keranjang & checkout fisik/jasa -- port dari Home::keranjang()/keranjangjasa()/
// pembayaran()/pembayaranjasa()/invoice() (CI3). URL dipertahankan sama.
$routes->get('home/keranjang', 'Home::keranjang');
$routes->get('home/keranjangjasa', 'Home::keranjangjasa');
$routes->get('home/pembayaran', 'Home::pembayaran');
$routes->get('home/pembayaranjasa', 'Home::pembayaranjasa');
$routes->get('home/invoice', 'Home::invoice');

// Manage -- dashboard "Akun Saya" (lihat catatan di app/Controllers/Manage.php)
$routes->get('manage', 'Manage::index');
$routes->get('manage/lacakpaket/(:any)', 'Manage::lacakpaket/$1');
$routes->get('manage/produk', 'Manage::produk');
$routes->get('manage/pesanan', 'Manage::pesanan');
$routes->get('manage/pesananppob', 'Manage::pesananppob');
$routes->get('manage/historidigital', 'Manage::historidigital');
$routes->get('manage/strukdigital/(:num)', 'Manage::strukdigital/$1');
$routes->get('manage/ulasan/(:any)', 'Manage::ulasan/$1');
$routes->get('manage/pesan', 'Manage::pesan');

// Assync -- profil/password/PIN + alamat (lihat catatan di app/Controllers/Assync.php)
$routes->post('assync/updateprofil', 'Assync::updateProfil');
$routes->post('assync/updatepass', 'Assync::updatePass');
$routes->post('assync/updatepin', 'Assync::updatePin');
$routes->post('assync/tambahalamat', 'Assync::tambahAlamat');
$routes->post('assync/getalamat', 'Assync::getAlamat');
$routes->post('assync/hapusalamat', 'Assync::hapusAlamat');
$routes->post('assync/getkab', 'Assync::getKab');
$routes->post('assync/getkec', 'Assync::getKec');
$routes->post('assync/getkel', 'Assync::getKel');
$routes->post('assync/tambahrekening', 'Assync::tambahRekening');
$routes->post('assync/getrekening', 'Assync::getRekening');
$routes->post('assync/hapusrekening', 'Assync::hapusRekening');
$routes->get('assync/gethistorytarik', 'Assync::getHistoryTarik');
$routes->get('assync/gethistorytopup', 'Assync::getHistoryTopup');
$routes->post('assync/topupsaldo', 'Assync::topupSaldo');
$routes->post('assync/bataltopup', 'Assync::batalTopup');
$routes->post('assync/midtranstokentopup', 'Assync::midtransTokenTopup');
// Webhook Midtrans -- dipanggil server Midtrans langsung, no-auth/no-CSRF.
$routes->post('assync/midtranswebhook', 'Assync::midtransWebhook');

// Assync -- keranjang & checkout fisik/jasa (lihat catatan di app/Controllers/Assync.php)
$routes->post('assync/prosesbeli', 'Assync::prosesBeli');
$routes->post('assync/hapuskeranjang', 'Assync::hapusKeranjang');
$routes->post('assync/updatekeranjang', 'Assync::updateKeranjang');
$routes->post('assync/cekvoucher', 'Assync::cekVoucher');
$routes->post('assync/cekpin', 'Assync::cekPin');
$routes->post('assync/cekongkir', 'Assync::cekOngkir');
$routes->post('assync/tambahulasan', 'Assync::tambahUlasan');
$routes->post('assync/kirimpesan', 'Assync::kirimPesan');
$routes->get('assync/cekpesanbaru', 'Assync::cekPesanBaru');

// Assync -- status pesanan fisik/jasa (lihat catatan di app/Controllers/Assync.php)
$routes->get('assync/pesanan', 'Assync::pesanan');
$routes->post('assync/terimapesanan', 'Assync::terimaPesanan');
$routes->post('assync/requestbatalkanpesanan', 'Assync::requestbatalkanPesanan');
$routes->post('assync/batalkanpesanan', 'Assync::batalkanPesanan');
$routes->post('assync/perpanjangpesanan', 'Assync::perpanjangPesanan');
$routes->post('assync/bayarulangpesanan', 'Assync::bayarulangpesanan');
$routes->get('assync/cekmidtrans', 'Assync::cekmidtrans');
$routes->post('manage/konfirmasi', 'Manage::konfirmasi');
