package epson.print.rpcopy.Component.eremoteoperation;

import epson.print.rpcopy.Component.eremoteoperation.ERemoteOperation;
import java.util.ArrayList;
import org.json.JSONObject;

public class ERemoteCopy extends ERemoteOperation {

    public interface IRemoteCancelParameter extends ERemoteOperation.IRemoteOperationParameter {
        String job_token();
    }

    public interface IRemoteCopyDocumentChangedParameter extends ERemoteOperation.IRemoteOperationParameter {
        String job_token();

        boolean next_document();
    }

    public interface IRemoteCopyOptionsParameter extends ERemoteOperation.IRemoteOperationParameter {
        boolean default_as_fixed();

        ArrayList<ERemoteOperation.ERemoteParam> fixed_parameters();

        ERemoteOperation.ERemoteParam layout();

        ArrayList<ERemoteOperation.ERemoteParam> preferred_parameters();

        ERemoteOperation.ERemoteParam print_media_size();

        ERemoteOperation.ERemoteParam print_media_source();

        ERemoteOperation.ERemoteParam print_media_type();

        ERemoteOperation.ERemoteParam print_quality();

        ERemoteOperation.ERemoteParam print_sheet_collate();

        ERemoteOperation.ERemoteParam print_sides();

        ArrayList<ERemoteOperation.ERemoteParam> priority_order();

        ERemoteOperation.ERemoteParam scan_content_type();

        ERemoteOperation.ERemoteParam scan_media_size();

        ERemoteOperation.ERemoteParam scan_sides();
    }

    public interface IRemoteCopyParameter extends ERemoteOperation.IRemoteOperationParameter {
        ERemoteOperation.ERemoteParam color_effects_type();

        int copies();

        int copy_magnification();

        ERemoteOperation.ERemoteParam layout();

        ERemoteOperation.ERemoteParam orientation();

        ERemoteOperation.ERemoteParam print_media_size();

        ERemoteOperation.ERemoteParam print_media_source();

        ERemoteOperation.ERemoteParam print_media_type();

        ERemoteOperation.ERemoteParam print_quality();

        ERemoteOperation.ERemoteParam print_sheet_collate();

        ERemoteOperation.ERemoteParam print_sides();

        ERemoteOperation.ERemoteParam print_x_auto_pg();

        ERemoteOperation.ERemoteParam print_x_bleed();

        ERemoteOperation.ERemoteParam print_x_dry_time();

        ERemoteOperation.ERemoteParam scan_content_type();

        ERemoteOperation.ERemoteParam scan_media_size();

        ERemoteOperation.ERemoteParam scan_sides();

        int x_density();
    }

    public interface IRemoteCopyStatusParameter extends ERemoteOperation.IRemoteStatusParameter {
        String job_token();
    }

    public class ERemoteCopyOptionsResult extends ERemoteOperation.ERemoteReasonResult {
        public ERemoteCopyOptionsResult(JSONObject jSONObject) {
            super(jSONObject);
        }

        public ArrayList<ERemoteOperation.ERemoteParam> parameter_options(ERemoteOperation.ERemoteParam eRemoteParam) {
            return getOptionsValueOf(eRemoteParam);
        }

        public ERemoteOperation.ERemoteParam parameter_default(ERemoteOperation.ERemoteParam eRemoteParam) {
            return getDefaultValueOf(eRemoteParam);
        }

        public ArrayList<ERemoteOperation.ERemoteParam> local_options(ERemoteOperation.ERemoteParam eRemoteParam) {
            ArrayList<ERemoteOperation.ERemoteParam> arrayList = new ArrayList<>();
            if (eRemoteParam == ERemoteOperation.ERemoteParam.color_effects_type) {
                arrayList.add(ERemoteOperation.ERemoteParam.color);
                arrayList.add(ERemoteOperation.ERemoteParam.monochrome_grayscale);
                return arrayList;
            } else if (eRemoteParam != ERemoteOperation.ERemoteParam.print_x_bleed) {
                return arrayList;
            } else {
                ERemoteOperation.ERemoteParam eRemoteParam2 = (ERemoteOperation.ERemoteParam) this.request.remoteParam.get(ERemoteOperation.ERemoteParam.print_media_size);
                arrayList.add(ERemoteOperation.ERemoteParam.standard);
                arrayList.add(ERemoteOperation.ERemoteParam.midium);
                arrayList.add(ERemoteOperation.ERemoteParam.minimum);
                return arrayList;
            }
        }

        public ERemoteOperation.ERemoteParam local_default(ERemoteOperation.ERemoteParam eRemoteParam) {
            if (eRemoteParam == ERemoteOperation.ERemoteParam.color_effects_type) {
                return ERemoteOperation.ERemoteParam.color;
            }
            if (eRemoteParam == ERemoteOperation.ERemoteParam.print_x_bleed) {
                return ERemoteOperation.ERemoteParam.standard;
            }
            if (eRemoteParam == ERemoteOperation.ERemoteParam.x_scale) {
                return ERemoteOperation.ERemoteParam.x_scale_autofit;
            }
            return ERemoteOperation.ERemoteParam.x_null;
        }

        public class ScaleOptions {
            ArrayList<ERemoteOperation.ERemoteParam> mediaSizeList;
            ArrayList<ERemoteOperation.ERemoteParam> scalePresets;

            public ScaleOptions(ArrayList<ERemoteOperation.ERemoteParam> arrayList) {
                this.mediaSizeList = arrayList;
            }

            public ArrayList<ERemoteOperation.ERemoteParam> scale_options() {
                this.scalePresets = new ArrayList<>();
                this.scalePresets.add(ERemoteOperation.ERemoteParam.x_scale_autofit);
                this.scalePresets.add(ERemoteOperation.ERemoteParam.x_scale_fullsize);
                this.scalePresets.add(ERemoteOperation.ERemoteParam.x_scale_custom);
                checkPaperSize(ERemoteOperation.ERemoteParam.na_letter_8_5x11in, ERemoteOperation.ERemoteParam.na_index_4x6_4x6in, ERemoteOperation.ERemoteParam.x_scale_letter_to_kg);
                checkPaperSize(ERemoteOperation.ERemoteParam.na_index_4x6_4x6in, ERemoteOperation.ERemoteParam.na_letter_8_5x11in, ERemoteOperation.ERemoteParam.x_scale_kg_to_letter);
                checkPaperSize(ERemoteOperation.ERemoteParam.na_letter_8_5x11in, ERemoteOperation.ERemoteParam.na_5x7_5x7in, ERemoteOperation.ERemoteParam.x_scale_letter_to_2l);
                checkPaperSize(ERemoteOperation.ERemoteParam.na_5x7_5x7in, ERemoteOperation.ERemoteParam.na_letter_8_5x11in, ERemoteOperation.ERemoteParam.x_scale_2l_to_letter);
                checkPaperSize(ERemoteOperation.ERemoteParam.na_index_4x6_4x6in, ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.x_scale_kg_to_a4);
                checkPaperSize(ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.na_index_4x6_4x6in, ERemoteOperation.ERemoteParam.x_scale_a4_to_kg);
                checkPaperSize(ERemoteOperation.ERemoteParam.na_5x7_5x7in, ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.x_scale_2l_to_a4);
                checkPaperSize(ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.na_5x7_5x7in, ERemoteOperation.ERemoteParam.x_scale_a4_to_2l);
                checkPaperSize(ERemoteOperation.ERemoteParam.na_index_4x6_4x6in, ERemoteOperation.ERemoteParam.na_govt_letter_8x10in, ERemoteOperation.ERemoteParam.x_scale_kg_to_8x10);
                checkPaperSize(ERemoteOperation.ERemoteParam.na_govt_letter_8x10in, ERemoteOperation.ERemoteParam.na_5x7_5x7in, ERemoteOperation.ERemoteParam.x_scale_8x10_to_2l);
                checkPaperSize(ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.jpn_hagaki_100x148mm, ERemoteOperation.ERemoteParam.x_scale_a4_to_postcard);
                checkPaperSize(ERemoteOperation.ERemoteParam.na_5x7_5x7in, ERemoteOperation.ERemoteParam.jpn_hagaki_100x148mm, ERemoteOperation.ERemoteParam.x_scale_2l_to_postcard);
                checkPaperSize(ERemoteOperation.ERemoteParam.oe_photo_l_3_5x5in, ERemoteOperation.ERemoteParam.jpn_hagaki_100x148mm, ERemoteOperation.ERemoteParam.x_scale_l_to_postcard);
                checkPaperSize(ERemoteOperation.ERemoteParam.oe_photo_l_3_5x5in, ERemoteOperation.ERemoteParam.na_5x7_5x7in, ERemoteOperation.ERemoteParam.x_scale_l_to_2l);
                checkPaperSize(ERemoteOperation.ERemoteParam.jpn_hagaki_100x148mm, ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.x_scale_postcard_to_a4);
                checkPaperSize(ERemoteOperation.ERemoteParam.oe_photo_l_3_5x5in, ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.x_scale_l_to_a4);
                checkPaperSize(ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.jis_b5_182x257mm, ERemoteOperation.ERemoteParam.x_scale_a4_to_b5);
                checkPaperSize(ERemoteOperation.ERemoteParam.jis_b5_182x257mm, ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.x_scale_b5_to_a4);
                checkPaperSize(ERemoteOperation.ERemoteParam.na_5x7_5x7in, ERemoteOperation.ERemoteParam.na_index_4x6_4x6in, ERemoteOperation.ERemoteParam.x_scale_2l_to_kg);
                checkPaperSize(ERemoteOperation.ERemoteParam.na_index_4x6_4x6in, ERemoteOperation.ERemoteParam.na_5x7_5x7in, ERemoteOperation.ERemoteParam.x_scale_kg_to_2l);
                checkPaperSize(ERemoteOperation.ERemoteParam.iso_a5_148x210mm, ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.x_scale_a5_to_a4);
                checkPaperSize(ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.iso_a5_148x210mm, ERemoteOperation.ERemoteParam.x_scale_a4_to_a5);
                checkPaperSize(ERemoteOperation.ERemoteParam.iso_a4_210x297mm, ERemoteOperation.ERemoteParam.iso_a3_297x420mm, ERemoteOperation.ERemoteParam.x_scale_a4_to_a3);
                checkPaperSize(ERemoteOperation.ERemoteParam.na_letter_8_5x11in, ERemoteOperation.ERemoteParam.na_ledger_11x17in, ERemoteOperation.ERemoteParam.x_scale_letter_to_11x17);
                return this.scalePresets;
            }

            private void checkPaperSize(ERemoteOperation.ERemoteParam eRemoteParam, ERemoteOperation.ERemoteParam eRemoteParam2, ERemoteOperation.ERemoteParam eRemoteParam3) {
                if (this.mediaSizeList.contains(eRemoteParam) && this.mediaSizeList.contains(eRemoteParam2)) {
                    this.scalePresets.add(eRemoteParam3);
                }
            }
        }
    }

    public class ERemoteCopyResult extends ERemoteOperation.ERemoteReasonResult {
        public ERemoteCopyResult(JSONObject jSONObject) {
            super(jSONObject);
        }

        public String job_token() {
            return getStringValueOf(ERemoteOperation.ERemoteParam.job_token);
        }
    }

    public class ERemoteCopyStatusResult extends ERemoteOperation.ERemoteReasonResult {
        public ERemoteCopyStatusResult(JSONObject jSONObject) {
            super(jSONObject);
        }

        public ERemoteOperation.ERemoteParam print_x_disc_tray_state() {
            return getParamValueOf(ERemoteOperation.ERemoteParam.print_x_disc_tray_state);
        }

        public ERemoteOperation.ERemoteParam printer_state() {
            return getParamValueOf(ERemoteOperation.ERemoteParam.printer_state);
        }

        public ArrayList<ERemoteOperation.ERemoteParam> printer_state_reasons() {
            return getParamsValueOf(ERemoteOperation.ERemoteParam.printer_state_reasons);
        }

        public boolean document_on_adf() {
            return getBooleanValueOf(ERemoteOperation.ERemoteParam.document_on_adf);
        }

        public ERemoteOperation.ERemoteParam scanner_state() {
            return getParamValueOf(ERemoteOperation.ERemoteParam.scanner_state);
        }

        public ArrayList<ERemoteOperation.ERemoteParam> scanner_state_reasons() {
            return getParamsValueOf(ERemoteOperation.ERemoteParam.scanner_state_reasons);
        }

        public ERemoteOperation.ERemoteParam job_state() {
            return getParamValueOf(ERemoteOperation.ERemoteParam.job_state);
        }

        public ERemoteOperation.ERemoteParam job_result() {
            return getParamValueOf(ERemoteOperation.ERemoteParam.job_result);
        }

        public ArrayList<String> job_tokens() {
            return getStringsValueOf(ERemoteOperation.ERemoteParam.job_tokens);
        }

        public int job_print_total_pages() {
            return getIntValueOf(ERemoteOperation.ERemoteParam.job_print_total_pages);
        }

        public int job_print_current_pages() {
            return getIntValueOf(ERemoteOperation.ERemoteParam.job_print_current_pages);
        }
    }

    public ERemoteCopyResult copy(IRemoteCopyParameter iRemoteCopyParameter, ERemoteOperation.ERemoteParam eRemoteParam, ERemoteOperation.ERemoteParam eRemoteParam2, ERemoteOperation.ERemoteParam eRemoteParam3, ERemoteOperation.ERemoteParam eRemoteParam4, ERemoteOperation.ERemoteParam eRemoteParam5) {
        ERemoteOperation.ERemoteRequestBuilder requestCopy = ERemoteOperation.ERemoteRequestBuilder.requestCopy(this.hostIP, ERemoteOperation.RequestParam.copy, getRequestConnectionTimeout());
        requestCopy.add(ERemoteOperation.ERemoteParam.client_id, iRemoteCopyParameter.client_id());
        requestCopy.add(ERemoteOperation.ERemoteParam.layout, eRemoteParam);
        requestCopy.add(ERemoteOperation.ERemoteParam.print_media_type, iRemoteCopyParameter.print_media_type());
        requestCopy.add(ERemoteOperation.ERemoteParam.print_media_size, iRemoteCopyParameter.print_media_size());
        requestCopy.add(ERemoteOperation.ERemoteParam.print_media_source, iRemoteCopyParameter.print_media_source());
        requestCopy.add(ERemoteOperation.ERemoteParam.print_quality, iRemoteCopyParameter.print_quality());
        requestCopy.add(ERemoteOperation.ERemoteParam.x_remove_background, eRemoteParam2);
        if (!eRemoteParam3.equals(ERemoteOperation.ERemoteParam.dash)) {
            requestCopy.add(ERemoteOperation.ERemoteParam.x_cut_line, eRemoteParam3);
            requestCopy.add(ERemoteOperation.ERemoteParam.x_cut_line_style, eRemoteParam4);
            requestCopy.add(ERemoteOperation.ERemoteParam.x_cut_line_weight, eRemoteParam5);
        }
        requestCopy.add(ERemoteOperation.ERemoteParam.copies, iRemoteCopyParameter.copies());
        requestCopy.add(ERemoteOperation.ERemoteParam.color_effects_type, iRemoteCopyParameter.color_effects_type());
        requestCopy.add(ERemoteOperation.ERemoteParam.x_density, iRemoteCopyParameter.x_density());
        return new ERemoteCopyResult(requestCopy.getRemoteRequest().execute());
    }

    public ERemoteCopyOptionsResult getOptions(IRemoteCopyOptionsParameter iRemoteCopyOptionsParameter, ERemoteOperation.ERemoteParam eRemoteParam, ERemoteOperation.ERemoteParam eRemoteParam2, ERemoteOperation.ERemoteParam eRemoteParam3, ERemoteOperation.ERemoteParam eRemoteParam4, ERemoteOperation.ERemoteParam eRemoteParam5) {
        ERemoteOperation.ERemoteRequestBuilder requestCopy = ERemoteOperation.ERemoteRequestBuilder.requestCopy(this.hostIP, ERemoteOperation.RequestParam.get_options, getRequestConnectionTimeout());
        requestCopy.add(ERemoteOperation.ERemoteParam.client_id, iRemoteCopyOptionsParameter.client_id());
        requestCopy.add(ERemoteOperation.ERemoteParam.layout, iRemoteCopyOptionsParameter.layout());
        requestCopy.add(ERemoteOperation.ERemoteParam.print_media_type, iRemoteCopyOptionsParameter.print_media_type());
        requestCopy.add(ERemoteOperation.ERemoteParam.print_media_size, iRemoteCopyOptionsParameter.print_media_size());
        requestCopy.add(ERemoteOperation.ERemoteParam.print_media_source, iRemoteCopyOptionsParameter.print_media_source());
        requestCopy.add(ERemoteOperation.ERemoteParam.print_quality, iRemoteCopyOptionsParameter.print_quality());
        requestCopy.add(ERemoteOperation.ERemoteParam.x_remove_background, eRemoteParam);
        requestCopy.add(ERemoteOperation.ERemoteParam.color_effects_type, eRemoteParam2);
        requestCopy.add(ERemoteOperation.ERemoteParam.x_cut_line, eRemoteParam3);
        requestCopy.add(ERemoteOperation.ERemoteParam.x_cut_line_style, eRemoteParam4);
        requestCopy.add(ERemoteOperation.ERemoteParam.x_cut_line_weight, eRemoteParam5);
        requestCopy.add(ERemoteOperation.ERemoteParam.fixed_parameters, iRemoteCopyOptionsParameter.fixed_parameters());
        requestCopy.add(ERemoteOperation.ERemoteParam.preferred_parameters, iRemoteCopyOptionsParameter.priority_order());
        requestCopy.add(ERemoteOperation.ERemoteParam.priority_order, iRemoteCopyOptionsParameter.priority_order());
        requestCopy.add(ERemoteOperation.ERemoteParam.default_as_fixed, iRemoteCopyOptionsParameter.default_as_fixed());
        ERemoteCopyOptionsResult eRemoteCopyOptionsResult = new ERemoteCopyOptionsResult(requestCopy.getRemoteRequest().execute());
        eRemoteCopyOptionsResult.setRemoteRequestBuilder(requestCopy);
        return eRemoteCopyOptionsResult;
    }

    public ERemoteCopyOptionsResult getSelectableOptions() {
        ArrayList arrayList = new ArrayList();
        ERemoteOperation.ERemoteRequestBuilder requestCopy = ERemoteOperation.ERemoteRequestBuilder.requestCopy(this.hostIP, ERemoteOperation.RequestParam.get_options, getRequestConnectionTimeout());
        requestCopy.add(ERemoteOperation.ERemoteParam.client_id, ERemoteOperation.ERemoteParam.x_null.string);
        requestCopy.add(ERemoteOperation.ERemoteParam.color_effects_type, ERemoteOperation.ERemoteParam.x_null);
        requestCopy.add(ERemoteOperation.ERemoteParam.layout, ERemoteOperation.ERemoteParam.x_null);
        requestCopy.add(ERemoteOperation.ERemoteParam.print_media_size, ERemoteOperation.ERemoteParam.x_null);
        requestCopy.add(ERemoteOperation.ERemoteParam.print_media_type, ERemoteOperation.ERemoteParam.x_null);
        requestCopy.add(ERemoteOperation.ERemoteParam.print_media_source, ERemoteOperation.ERemoteParam.x_null);
        requestCopy.add(ERemoteOperation.ERemoteParam.print_quality, ERemoteOperation.ERemoteParam.x_null);
        requestCopy.add(ERemoteOperation.ERemoteParam.x_remove_background, ERemoteOperation.ERemoteParam.x_null);
        requestCopy.add(ERemoteOperation.ERemoteParam.x_cut_line, ERemoteOperation.ERemoteParam.x_null);
        requestCopy.add(ERemoteOperation.ERemoteParam.x_cut_line_style, ERemoteOperation.ERemoteParam.x_null);
        requestCopy.add(ERemoteOperation.ERemoteParam.x_cut_line_weight, ERemoteOperation.ERemoteParam.x_null);
        requestCopy.add(ERemoteOperation.ERemoteParam.fixed_parameters, (ArrayList<ERemoteOperation.ERemoteParam>) new ArrayList());
        requestCopy.add(ERemoteOperation.ERemoteParam.preferred_parameters, (ArrayList<ERemoteOperation.ERemoteParam>) new ArrayList());
        requestCopy.add(ERemoteOperation.ERemoteParam.priority_order, (ArrayList<ERemoteOperation.ERemoteParam>) arrayList);
        requestCopy.add(ERemoteOperation.ERemoteParam.default_as_fixed, false);
        ERemoteCopyOptionsResult eRemoteCopyOptionsResult = new ERemoteCopyOptionsResult(requestCopy.getRemoteRequest().execute());
        eRemoteCopyOptionsResult.setRemoteRequestBuilder(requestCopy);
        return eRemoteCopyOptionsResult;
    }

    public ERemoteCopyStatusResult getStatus(IRemoteCopyStatusParameter iRemoteCopyStatusParameter) {
        ERemoteOperation.ERemoteRequestBuilder requestCopy = ERemoteOperation.ERemoteRequestBuilder.requestCopy(this.hostIP, ERemoteOperation.RequestParam.get_status, getRequestConnectionTimeout());
        requestCopy.add(ERemoteOperation.ERemoteParam.client_id, iRemoteCopyStatusParameter.client_id());
        requestCopy.add(ERemoteOperation.ERemoteParam.keys, iRemoteCopyStatusParameter.keys());
        requestCopy.add(ERemoteOperation.ERemoteParam.job_token, iRemoteCopyStatusParameter.job_token());
        ERemoteCopyStatusResult eRemoteCopyStatusResult = new ERemoteCopyStatusResult(requestCopy.getRemoteRequest().execute());
        eRemoteCopyStatusResult.setRemoteRequestBuilder(requestCopy);
        return eRemoteCopyStatusResult;
    }

    public ERemoteOperation.ERemoteReasonResult cancel(IRemoteCancelParameter iRemoteCancelParameter) {
        ERemoteOperation.ERemoteRequestBuilder requestCopy = ERemoteOperation.ERemoteRequestBuilder.requestCopy(this.hostIP, ERemoteOperation.RequestParam.cancel, getRequestConnectionTimeout());
        requestCopy.add(ERemoteOperation.ERemoteParam.client_id, iRemoteCancelParameter.client_id());
        requestCopy.add(ERemoteOperation.ERemoteParam.job_token, iRemoteCancelParameter.job_token());
        ERemoteOperation.ERemoteReasonResult eRemoteReasonResult = new ERemoteOperation.ERemoteReasonResult(requestCopy.getRemoteRequest().execute());
        eRemoteReasonResult.setRemoteRequestBuilder(requestCopy);
        return eRemoteReasonResult;
    }

    public ERemoteOperation.ERemoteReasonResult documentChanged(IRemoteCopyDocumentChangedParameter iRemoteCopyDocumentChangedParameter) {
        ERemoteOperation.ERemoteRequestBuilder requestCopy = ERemoteOperation.ERemoteRequestBuilder.requestCopy(this.hostIP, ERemoteOperation.RequestParam.document_changed, getRequestConnectionTimeout());
        requestCopy.add(ERemoteOperation.ERemoteParam.client_id, iRemoteCopyDocumentChangedParameter.client_id());
        requestCopy.add(ERemoteOperation.ERemoteParam.job_token, iRemoteCopyDocumentChangedParameter.job_token());
        requestCopy.add(ERemoteOperation.ERemoteParam.next_document, iRemoteCopyDocumentChangedParameter.next_document());
        ERemoteOperation.ERemoteReasonResult eRemoteReasonResult = new ERemoteOperation.ERemoteReasonResult(requestCopy.getRemoteRequest().execute());
        eRemoteReasonResult.setRemoteRequestBuilder(requestCopy);
        return eRemoteReasonResult;
    }
}
