<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class TransactionOnlineStatus extends Model
{
    const BILL_CREATED = 1;
    const INITIALIZED_TRANSACTION = 2;
    const UPDATED_TAG_PORTAL = 3;
    const UPDATE_TRANSACTION_CALLBACK = 4;
    const UPDATE_TRANSACTION_REDIRECT = 5;
    const CRONJOB_UPDATE_TRANSACTION = 6;
    const CRONJOB_UPDATE_TRANSAKSI_KEUNTUNGAN = 7;
    const CRONJOB_UPDATE_GADAI = 8;
    const CRONJOB_REGISTER_AUDIT = 9;
    const CRONJOB_REGISTER_GLDETAIL = 10;
    const CRONJOB_UPDATE_TRANSAKSI_ONLINE = 11;
    const UPDATE_UNSUCCESSFUL_TRANSACTION = 12;
    
    
    public static function listStatus()
    {
        return [
            self::BILL_CREATED => 'Bill Created',
            self::INITIALIZED_TRANSACTION => 'Initialized Transaction',
            self::UPDATED_TAG_PORTAL => 'Updated Tag Portal',
            self::UPDATE_TRANSACTION_CALLBACK => 'Update Transaction Callback',
            self::UPDATE_TRANSACTION_REDIRECT => 'Update Transaction Redirect',
            self::CRONJOB_UPDATE_TRANSACTION => 'Cronjob Update Transaction',
            self::CRONJOB_UPDATE_TRANSAKSI_KEUNTUNGAN => 'Cronjob Update Transaksi Keuntungan',
            self::CRONJOB_UPDATE_GADAI => 'Cronjob Update Gadai',
            self::CRONJOB_REGISTER_AUDIT => 'Cronjob Register Audit',
            self::CRONJOB_REGISTER_GLDETAIL => 'Cronjob Register GlDetail',
            self::CRONJOB_UPDATE_TRANSAKSI_ONLINE => 'Cronjob Update Transaksi Online',
            self::UPDATE_UNSUCCESSFUL_TRANSACTION => 'Update Unsuccessful Transaction',
        ];
    }   
    
    public static function statusLabel($status_code)
    {
        $list = self::listStatus();

        return isset($list[$status_code]) 
            ? $list[$status_code] 
            : $status_code;
    }
}
