import { h } from "@stencil/core";
import { card, heading2, table, tableCell, tableHeadCell } from "../../../../styles/parts";
export class DocumentUploadList {
    constructor() {
        this.documents = [];
    }
    renderStatus(status) {
        switch (status) {
            case 'uploading':
                return h("span", { class: "badge bg-info" }, "Uploading...");
            case 'uploaded':
                return h("span", { class: "badge bg-success" }, "Uploaded");
            case 'error':
                return h("span", { class: "badge bg-danger" }, "Error");
        }
    }
    render() {
        if (!this.documents.length) {
            return null;
        }
        return (h("div", { class: "mt-4" }, h("div", { class: "card", part: card }, h("div", { class: "card-body" }, h("h5", { class: "card-title", part: heading2 }, "Uploaded Documents"), h("div", { class: "table-responsive" }, h("table", { class: "table table-sm table-borderless", part: table }, h("thead", null, h("tr", null, h("th", { style: { width: '25%' }, part: tableHeadCell, scope: "col" }, "Category"), h("th", { style: { width: '25%' }, part: tableHeadCell, scope: "col" }, "Document Type"), h("th", { style: { width: '30%' }, part: tableHeadCell, scope: "col" }, "File Name"), h("th", { style: { width: '20%' }, part: tableHeadCell, scope: "col" }, "Status"))), h("tbody", null, this.documents.map((doc, index) => (h("tr", { class: index === 0 ? 'border-bottom border-top' : 'border-bottom' }, h("td", { part: tableCell }, doc.categoryLabel), h("td", { part: tableCell }, doc.docTypeLabel), h("td", { part: tableCell }, doc.fileName), h("td", { part: tableCell }, this.renderStatus(doc.status))))))))))));
    }
    static get is() { return "document-upload-list"; }
    static get properties() {
        return {
            "documents": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "UploadedDocumentEntry[]",
                    "resolved": "UploadedDocumentEntry[]",
                    "references": {
                        "UploadedDocumentEntry": {
                            "location": "import",
                            "path": "./document-upload-options",
                            "id": "src/components/business-forms/payment-provisioning/document-upload/document-upload-options.ts::UploadedDocumentEntry"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "defaultValue": "[]"
            }
        };
    }
}
