var DisputeResponseFormStep;
(function (DisputeResponseFormStep) {
    DisputeResponseFormStep["disputeReason"] = "dispute_reason";
    DisputeResponseFormStep["productOrService"] = "product_or_service";
    DisputeResponseFormStep["customerDetails"] = "customer_details";
    DisputeResponseFormStep["cancellationPolicy"] = "cancellation_policy";
    DisputeResponseFormStep["refundPolicy"] = "refund_policy";
    DisputeResponseFormStep["duplicateCharge"] = "duplicate_charge";
    DisputeResponseFormStep["electronicEvidence"] = "electronic_evidence";
    DisputeResponseFormStep["shippingDetails"] = "shipping_details";
    DisputeResponseFormStep["additionalStatement"] = "additional_statement";
})(DisputeResponseFormStep || (DisputeResponseFormStep = {}));

var DisputeEvidenceDocumentType;
(function (DisputeEvidenceDocumentType) {
    DisputeEvidenceDocumentType["activity_log"] = "activity_log";
    DisputeEvidenceDocumentType["cancellationPolicy"] = "cancellation_policy";
    DisputeEvidenceDocumentType["customerCommunication"] = "customer_communication";
    DisputeEvidenceDocumentType["customerSignature"] = "customer_signature";
    DisputeEvidenceDocumentType["duplicateChargeDocumentation"] = "duplicate_charge_documentation";
    DisputeEvidenceDocumentType["receipt"] = "receipt";
    DisputeEvidenceDocumentType["refundPolicy"] = "refund_policy";
    DisputeEvidenceDocumentType["serviceDocumentation"] = "service_documentation";
    DisputeEvidenceDocumentType["shippingDocumentation"] = "shipping_documentation";
    DisputeEvidenceDocumentType["uncategorizedFile"] = "uncategorized_file";
})(DisputeEvidenceDocumentType || (DisputeEvidenceDocumentType = {}));
class DisputeEvidenceDocument {
    set presignedUrl(url) {
        this._presignedUrl = url;
    }
    get presignedUrl() {
        return this._presignedUrl;
    }
    async getFileString() {
        const fileDataPromise = new Promise((resolve, reject) => {
            const reader = new FileReader();
            reader.onload = (e) => {
                resolve(e.target.result);
            };
            reader.onerror = () => {
                reject(new Error('Error reading file'));
            };
            reader.readAsArrayBuffer(this._file);
        });
        return await fileDataPromise;
    }
    ;
    constructor(file, dispute_evidence_type) {
        this._file = file;
        this.file_name = file.name;
        this.file_type = file.type;
        this.dispute_evidence_type = dispute_evidence_type;
    }
}

const fileInputHandler = (e, documentState) => {
    const target = e.target;
    const name = target.name;
    const files = target.files;
    documentState[name] = [];
    for (const file of files) {
        documentState[name].push(new DisputeEvidenceDocument(file, name));
    }
};

export { DisputeResponseFormStep as D, fileInputHandler as f };
