import 'package:flutter/material.dart';

import '../main.dart';

class RouteForegroundBackground {
  String? routenya;
  String? idRef;
  RouteForegroundBackground(this.routenya, this.idRef) {
    if (routenya == '/detail_izin_pegawai')
      Navigator.pushNamed(
          GlobalVariable.navState.currentContext!, '/detail_izin',
          arguments: [idRef, 'izinPegawai','notif']);
    else if (routenya == '/detail_izin_saya')
      Navigator.pushNamed(
          GlobalVariable.navState.currentContext!, '/detail_izin',
          arguments: [idRef, 'izinSaya','notif']);
    else if (routenya == '/detail_lembur_pegawai')
      Navigator.pushNamed(
          GlobalVariable.navState.currentContext!, '/detail_lembur',
          arguments: [idRef, 'lemburPegawai','notif']);
    else if (routenya == '/detail_lembur_saya')
      Navigator.pushNamed(
          GlobalVariable.navState.currentContext!, '/detail_lembur',
          arguments: [idRef, 'lemburSaya','notif']);
    else if (routenya == '/detail_berita')
      Navigator.pushNamed(
          GlobalVariable.navState.currentContext!, '/detail_berita',
          arguments: idRef);
    else if (routenya == '/detail_pengumuman')
      Navigator.pushNamed(
          GlobalVariable.navState.currentContext!, '/detail_pengumuman',
          arguments: idRef);
    else if (routenya == '/detail_reimbursement_pegawai')
      Navigator.pushNamed(
          GlobalVariable.navState.currentContext!, '/detail_reimbursement',
          arguments: [idRef, 'reimbursementKaryawan']);
    else if (routenya == '/detail_reimbursement_saya')
      Navigator.pushNamed(
          GlobalVariable.navState.currentContext!, '/detail_reimbursement',
          arguments: [idRef, 'reimbursementSaya']);
    else if (routenya == '/permintaan_tukar_shift')
      Navigator.pushReplacementNamed(
        GlobalVariable.navState.currentContext!,
        '/detail_tukar_shift', arguments: [idRef,'/pengajuan_tukar_shift', 'notif']
      );
    else if (routenya == '/detail_data_diri')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/notifikasi_akun');
    else if (routenya == '/detail_data_keluarga')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/notifikasi_akun');
    else if (routenya == '/detail_data_pendidikan')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/notifikasi_akun');
    else if (routenya == '/detail_data_pengalaman_kerja')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/notifikasi_akun');
    else if (routenya == '/detail_data_kelengkapan_file')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/notifikasi_akun');
    else if (routenya == 'absensi')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/absensi');
    else if (routenya == '/detail_sos')
      Navigator.pushNamed(
        GlobalVariable.navState.currentContext!,
        '/halaman_detail_sos', arguments: [idRef]
      );
    else if (routenya == '/detail_pkwt_saya')
      Navigator.pushNamed(
          GlobalVariable.navState.currentContext!, '/detail_pkwt_saya',
          arguments: [idRef]);

    //     else if (routenya == '/pengajuan_tukar_shift')
      // Navigator.pushNamed(
      //   GlobalVariable.navState.currentContext!,
      //   '/parent_tukar_shift', arguments: '/pengajuan_tukar_shift'
      // );
    else if (routenya == '/notif_khusus') {
      launcherUrl(idRef!);
    } else
      Navigator.pushNamed(
          GlobalVariable.navState.currentContext!, 'splash_screen');
  }
}

class RouteOnlaunch {
  String? routenya;
  String? idRef;
  RouteOnlaunch(this.routenya, this.idRef) {
    if (routenya == '/detail_izin_pegawai')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/detail_izin',
          arguments: [idRef, 'izinPegawai', 'notif']);
    else if (routenya == '/detail_izin_saya')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/detail_izin',
          arguments: [idRef, 'izinSaya','notif']);
    else if (routenya == '/detail_lembur_pegawai')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/detail_lembur',
          arguments: [idRef, 'lemburPegawai','notif']);
    else if (routenya == '/detail_lembur_saya')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/detail_lembur',
          arguments: [idRef, 'lemburSaya','notif']);
    else if (routenya == '/detail_berita')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/detail_berita',
          arguments: idRef);
    else if (routenya == '/detail_pengumuman')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/detail_pengumuman',
          arguments: idRef);
    else if (routenya == '/detail_reimbursement_pegawai')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/detail_reimbursement',
          arguments: [idRef, 'reimbursementKaryawan']);
    else if (routenya == '/detail_reimbursement_saya')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/detail_reimbursement',
          arguments: [idRef, 'reimbursementSaya']);
    else if (routenya == '/detail_data_diri')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/notifikasi_akun');
    else if (routenya == '/detail_data_keluarga')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/notifikasi_akun');
    else if (routenya == '/detail_data_pendidikan')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/notifikasi_akun');
    else if (routenya == '/detail_data_pengalaman_kerja')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/notifikasi_akun');
    else if (routenya == '/detail_data_kelengkapan_file')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/notifikasi_akun');
    // else if (routenya == '/permintaan_tukar_shift')
    //   Navigator.pushReplacementNamed(
    //     GlobalVariable.navState.currentContext!,
    //     '/parent_tukar_shift', arguments: '/permintaan_tukar_shift'
    //   );
          else if (routenya == '/permintaan_tukar_shift')
      Navigator.pushReplacementNamed(
        GlobalVariable.navState.currentContext!,
        '/detail_tukar_shift', arguments: [idRef,'/pengajuan_tukar_shift', 'notif']
      );
      //     else if (routenya == '/detail_pengajuan')
      // Navigator.pushReplacementNamed(
      //     GlobalVariable.navState.currentContext!, '/detail_pengajuan',
      //     arguments: idRef);
    else if (routenya == 'absensi')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/absensi');
    else if (routenya == '/detail_sos')
      Navigator.pushReplacementNamed(
        GlobalVariable.navState.currentContext!,
        '/halaman_detail_sos', arguments: [idRef]
      );
    else if (routenya == '/detail_pkwt_saya')
      Navigator.pushReplacementNamed(
          GlobalVariable.navState.currentContext!, '/detail_pkwt_saya',
          arguments: [idRef]);
    else if (routenya == '/notif_khusus') {
      launcherUrl(idRef!);
    } else
      Navigator.pushNamed(
          GlobalVariable.navState.currentContext!, 'splash_screen');
  }
}
