import React from "react";
// eslint-disable-next-line @typescript-eslint/no-var-requires
var style = require("./defaultcert.module.css");
export var DefaultTemplate = function (props) {
    var json = props.document;
    var issuedDate = json["issuedOn"];
    var certificateName = json["name"];
    var recipientName = json["recipient"]["name"];
    var formattedDate = "";
    var d = new Date(issuedDate);
    var timestamp = Date.parse(issuedDate);
    if (issuedDate == "<issued date>") {
        formattedDate = issuedDate;
    }
    else if (isNaN(timestamp) == false) {
        var dtf = new Intl.DateTimeFormat("en", { year: "numeric", month: "short", day: "2-digit" });
        var _a = dtf.formatToParts(d), mo = _a[0].value, da = _a[2].value, ye = _a[4].value;
        formattedDate = da + " " + mo + " " + ye;
    }
    return (React.createElement("div", { className: style["cert-template"] },
        React.createElement("div", { className: style["cert-name-wrapper"] },
            React.createElement("span", { className: style["cert-name"] }, certificateName)),
        React.createElement("div", { className: style["recipient-name-wrapper"] },
            React.createElement("span", { className: style["recipient-name"] }, recipientName)),
        React.createElement("div", { className: style["issued-date"] }, formattedDate)));
};
export var defaultTemplate = {
    id: "default-template",
    label: "Certificate",
    template: DefaultTemplate,
};
//# sourceMappingURL=DefaultTemplate.js.map