package epson.print.screen;

import android.content.Context;
import android.content.Intent;
import android.os.RemoteException;

import com.epson.iprint.prtlogger.PrintLog;

import epson.print.EPImageList;
import epson.print.service.IEpsonService;

class PrintProgressParams implements PrintProgress.ProgressParams {
    private boolean isDocument;
    private boolean mEpsonColorMode;
    private EPImageList mImageList;
    private PrintLog mPrintLog;

    public PrintProgressParams(Intent intent) {
        mImageList = (EPImageList) intent.getExtras().getParcelable(PrintProgress.PARAM_EP_IMAGE_LIST);
        isDocument = intent.getExtras().getBoolean(PrintProgress.PARAM_DOCUMENT_MODE, false);
        mEpsonColorMode = intent.getBooleanExtra(PrintProgress.PARAM_EPSON_COLOR, false);
        mPrintLog = (PrintLog) intent.getSerializableExtra("print_log");
    }

    public int getOriginalSheetSize() {
        return mImageList.size();
    }

    public boolean isPaperLandscape() {
        return mImageList.get(0).isPaperLandScape;
    }

    public PrintSetting getPrintSetting(Context context) {
        return new PrintSetting(context, isDocument ? PrintSetting.Kind.document : PrintSetting.Kind.photo);
    }

    public boolean getEpsonColorMode() {
        return mEpsonColorMode;
    }

    public boolean print(IEpsonService iEpsonService, boolean z) throws RemoteException {
        iEpsonService.print(this.mImageList, getPrintSettingType().name(), z);
        return true;
    }

    public PrintLog getPrintLog() {
        return mPrintLog;
    }

    public PrintSetting.Kind getPrintSettingType() {
        return isDocument ? PrintSetting.Kind.document : PrintSetting.Kind.photo;
    }

    public boolean getApfMode() {
        EPImageList ePImageList;
        if (!this.isDocument && (ePImageList = mImageList) != null && ePImageList.apfModeInPrinting == 1) {
            return true;
        }
        return false;
    }
}
