package com.epson.iprint.shared;

import android.os.Bundle;

import com.epson.mobilephone.common.PrintingLib.define.Constants;

import java.io.Serializable;
import java.util.ArrayList;

import epson.print.CommonDefine;

public class SharedParamPhoto extends SharedParam implements Serializable {
    private static final long serialVersionUID = 1;
    private ArrayList<String> arrayFileFullPath = null;
    private ArrayList<String> arrayFilePath = null;
    private int color_mode = 0;
    private int file_type = 0;
    private String folder_name = null;
    private int layout_type = 2;
    private int media_size = 0;
    private int media_type = 0;
    private int print_mode = 0;

    public /* bridge */ /* synthetic */ String getPackage_name() {
        return super.getPackage_name();
    }

    public /* bridge */ /* synthetic */ boolean isAvailable() {
        return super.isAvailable();
    }

    protected void setParam(Bundle bundle) throws SharedDataException {
        file_type = bundle.getInt("FILE_TYPE", 2);
        int i = file_type;
        if (i < 0 || i > 4) {
            throw new ParametersErrorException("FILE_TYPE errorr");
        }
        folder_name = bundle.getString("FOLDER_NAME");
        if (!this.folder_name.equals((Object) null)) {
            arrayFilePath = bundle.getStringArrayList("FILE_NAME");
            if (arrayFilePath.size() != 0) {
                print_mode = bundle.getInt("PRINT_MODE", 0);
                int i2 = print_mode;
                if (i2 < 0 || i2 > 1) {
                    throw new ParametersErrorException("PRINT_MODE error");
                }
                media_type = bundle.getInt("MEDIA_TYPE", 0);
                if (media_type == Constants.MediaName.EPS_MTID_PLAIN.getCode() || media_type == Constants.MediaName.EPS_MTID_PGPHOTO.getCode() || media_type == Constants.MediaName.EPS_MTID_HAGAKIRECL.getCode() || media_type == Constants.MediaName.EPS_MTID_HAGAKIINKJET.getCode()) {
                    media_size = bundle.getInt("MEDIA_SIZE", 0);
                    if (media_size == Constants.PaperName.EPS_MSID_A4.getCode() || media_size == Constants.PaperName.EPS_MSID_4X6.getCode() || media_size == Constants.PaperName.EPS_MSID_L.getCode() || media_size == Constants.PaperName.EPS_MSID_POSTCARD.getCode()) {
                        color_mode = bundle.getInt("COLOR_MODE", 0);
                        int i3 = color_mode;
                        if (i3 == 0 || i3 == 1) {
                            layout_type = bundle.getInt("LAYOUT_TYPE", 2);
                            int i4 = layout_type;
                            if (i4 == 1 || i4 == 2) {
                                package_name = bundle.getString(EpsoniPrintSharedActivity.PARAM_KEY_CALLER_PACKAGE_NAME);
                                if (!this.package_name.equals((Object) null)) {
                                    setFullPathName();
                                    isValid = true;
                                    return;
                                }
                                throw new ParametersErrorException("PACKAGE_NAME error");
                            }
                            throw new ParametersErrorException("LAYOUT_TYPE error");
                        }
                        throw new ParametersErrorException("COLOR_MODE error");
                    }
                    throw new ParametersErrorException("MEDIA_SIZE error");
                }
                throw new ParametersErrorException("MEDIA_TYPE error");
            }
            throw new ParametersErrorException("FILE_NAME error");
        }
        throw new ParametersErrorException("FOLDER_NAME error");
    }

    private void setFullPathName() {
        arrayFileFullPath = new ArrayList<>();
        for (int i = 0; i < arrayFilePath.size(); i++) {
            ArrayList<String> arrayList = arrayFileFullPath;
            arrayList.add(folder_name + CommonDefine.SLASH + arrayFilePath.get(i));
        }
    }

    public int getFile_type() {
        return file_type;
    }

    public boolean isTIFF() {
        return file_type == 4;
    }

    public boolean isFileTypeValid() {
        return file_type > 0;
    }

    public String getFolder_name() {
        return folder_name;
    }

    public ArrayList<String> getArrayFilePath() {
        return arrayFilePath;
    }

    public ArrayList<String> getArrayFileFullPath() {
        return arrayFileFullPath;
    }

    public void setArrayFileFullPath(String str) {
        arrayFileFullPath.add(str);
    }

    public void setArrayFileFullPath(int i, String str) {
        arrayFileFullPath.set(i, str);
    }

    public void clearArrayFileFullPath() {
        arrayFileFullPath.clear();
    }

    public int getPrint_mode() {
        return print_mode;
    }

    public int getMedia_type() {
        return media_type;
    }

    public int getMedia_size() {
        return media_size;
    }

    public int getColor_mode() {
        return color_mode;
    }

    public int getLayout_type() {
        return layout_type;
    }
}
