package com.epson.lib.escani2;

import com.epson.lib.escani2.EscanI2Lib;
import java.io.Serializable;

public class ScannerI2Info implements Serializable {
    public static final int ALIGNMENT_UNDEFINED = 255;
    public int adfAlignment;
    public int adfDuplexType;
    public boolean adfInstalled;
    public int adfSensorHeight;
    public int adfSensorWidth;
    public int adfType;
    public int flatbedAlignment;
    public boolean flatbedInstalled;
    public int flatbedSensorHeight;
    public int flatbedSensorWidth;
    public int imageSensorHeight;
    public int imageSensorWidth;
    public String productName;

    public int getSensorSizeBaseResolution() {
        return 100;
    }

    public int getAlignment(EscanI2Lib.InputUnit inputUnit) {
        switch (inputUnit) {
            case ADF:
                if (!this.adfInstalled) {
                    return 255;
                }
                return adfAlignment;
            case FLATBED:
                if (!this.flatbedInstalled) {
                    return 255;
                }
                return flatbedAlignment;
            default:
                return 255;
        }
    }

    public int[] getSensorPixelSize(EscanI2Lib.InputUnit inputUnit, int i, int i2) {
        int[] sensorSize = getSensorSize(inputUnit);
        int sensorSizeBaseResolution = getSensorSizeBaseResolution();
        if (i != sensorSizeBaseResolution) {
            sensorSize[0] = (int) ((((double) sensorSize[0]) * ((double) i)) / ((double) sensorSizeBaseResolution));
        }
        if (i2 != sensorSizeBaseResolution) {
            sensorSize[1] = (int) ((((double) sensorSize[1]) * ((double) i2)) / ((double) sensorSizeBaseResolution));
        }
        return sensorSize;
    }

    public int[] getSensorSize(EscanI2Lib.InputUnit inputUnit) {
        if (C09741.$SwitchMap$com$epson$lib$escani2$EscanI2Lib$InputUnit[inputUnit.ordinal()] != 1) {
            if (!this.flatbedInstalled) {
                return null;
            }
            return new int[]{this.flatbedSensorWidth, flatbedSensorHeight};
        } else if (!this.adfInstalled) {
            return null;
        } else {
            return new int[]{this.adfSensorWidth, adfSensorHeight};
        }
    }

    public boolean isAdfAlignmentInvalid() {
        return adfAlignment == 255;
    }
}
