export default class TransactionStatus {
    static NEW = "NEW";
    static FILLED = "FILLED";
    static PARTIALLY_FILLED = "PARTIALLY_FILLED";
    static PENDING_CANCEL = "PENDING_CANCEL";
    static REJECTED = "REJECTED";
    static EXPIRED = "EXPIRED";
    static CANCELED = "CANCELED";
    static UNKNOWN = "UNKNOWN";

    static toStatus(status){
        switch(status){
            case this.NEW:
                return this.NEW;
            case this.FILLED:
                return this.FILLED;
            case this.PARTIALLY_FILLED:
                return this.PARTIALLY_FILLED;
            case this.PENDING_CANCEL:
                return this.PENDING_CANCEL;
            case this.REJECTED:
                return this.REJECTED;
            case this.EXPIRED:
                return this.EXPIRED;
            case this.CANCELED:
                return this.CANCELED;
            default:
                return this.UNKNOWN;
        }
    }

    static isAtleastPartialyFilled(status){
        switch(status){
            case this.FILLED:
            case this.PARTIALLY_FILLED:
                return true;
            default:
                return false;
        }
    }

    static isCancled(status){
        switch(status){
            case this.CANCELED:
            case this.EXPIRED:
            case this.REJECTED:
                return true;
            default:
                return false;
        }
    }
}