import { h, Host } from "@stencil/core";
import { InfoCardMultiType } from "./info-card-multi-type.enum";
import { logger } from "../../../global/utils/logger";
import { TagMediaIcon } from "../../_tag/tag-media/tag-media-icon.enum";
/**
 * @slot default - Kan innehålla vad som helst
 *
 * @enums myEnum - info-card-multi-myEnum.enum.ts
 *
 * @swedishName Multikort
 */
export class InfoCardMulti {
    constructor() {
        this.afSrc = undefined;
        this.afAlt = undefined;
        this.afTagText = undefined;
        this.afTagIcon = TagMediaIcon.NEWS;
        this.afHeading = undefined;
        this.afHeadingLevel = undefined;
        this.afType = InfoCardMultiType.MEDIA;
        this.afLinkHref = undefined;
        this.hideVisitedColor = undefined;
        this.activeLink = false;
    }
    componentWillLoad() {
        this.validateHeading();
    }
    validateHeading() {
        if (!this.afHeading || !this.afHeadingLevel) {
            logger.warn(`digi-info-card must have a heading and a heading level. Please add af-heading and af-heading-level`, this.hostElement);
        }
    }
    clickLinkHandler(e) {
        this.afOnClickLink.emit(e);
    }
    get cssModifiers() {
        return {
            'digi-info-card-multi--media': this.afType === InfoCardMultiType.MEDIA,
            'digi-info-card-multi--related': this.afType === InfoCardMultiType.RELATED,
            'digi-info-card-multi--entry': this.afType === InfoCardMultiType.ENTRY,
            'digi-info-card-multi--hide-visited': this.hideVisitedColor
        };
    }
    render() {
        return (h(Host, { key: 'f43f48854d1f95e7a08785336f1920eb4e1be92c' }, h("div", { key: '4cb5f45d3fcbf471117628dba5c8c5c780c5d488', class: Object.assign({ 'digi-info-card-multi': true }, this.cssModifiers) }, h("div", { key: 'e0ab86cac5845360a37324094124371e489ae03a', class: "digi-info-card-multi__content" }, this.afType == InfoCardMultiType.MEDIA && (h("div", { key: '37fa2215b8e54bebae790c6f5c441c950e9d4815', class: "digi-info-card-multi__image" }, h("digi-media-image", { key: '10faaef3d9ecf2bcea967e2a132df4b8a6b062d3', afUnlazy: true, afFullwidth: true, "af-src": this.afSrc, afAlt: this.afAlt }, h("div", { key: '92a8d9713757098c6457864817ab9d6ed1fd0d72', class: "digi-info-card-multi__tag" }, h("digi-tag-media", { key: '5f3410be21018860e1df7ca15374fe6150c4a9b0', "af-icon": this.afTagIcon, afText: this.afTagText }))))), h("div", { key: '8a3e4dffc1ef8a62473915da6161a1b137eea570', class: "digi-info-card-multi__text" }, h(this.afHeadingLevel, { key: 'd08a9fcbd967809859236fed54305abf26468b59', class: "digi-info-card-multi__heading" }, h("a", { key: 'f20e0ff571e33d42bf50a6f89a0b2dbf0104d9fc', class: "digi-info-card-multi__link", href: this.afLinkHref, onMouseEnter: () => (this.activeLink = true), onFocus: () => (this.activeLink = true), onMouseLeave: () => (this.activeLink = false), onBlur: () => (this.activeLink = false), onClick: (e) => this.clickLinkHandler(e) }, this.afHeading)), h("digi-typography", { key: 'a36ac9fd73e4888eeeeb73c7112ccc31cd75314c' }, h("slot", { key: '83deb4c5ca5817b5799ad6edd90bdd87b85c68ff' })))))));
    }
    static get is() { return "digi-info-card-multi"; }
    static get encapsulation() { return "scoped"; }
    static get originalStyleUrls() {
        return {
            "$": ["info-card-multi.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["info-card-multi.css"]
        };
    }
    static get properties() {
        return {
            "afSrc": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Set `src` attribute."
                        }],
                    "text": "S\u00E4tter attributet 'src'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-src",
                "reflect": false
            },
            "afAlt": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Set `alt` attribute."
                        }],
                    "text": "S\u00E4tter attributet 'alt'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-alt",
                "reflect": false
            },
            "afTagText": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "set tag for image"
                        }],
                    "text": "S\u00E4tter Taggtext p\u00E5 bild"
                },
                "getter": false,
                "setter": false,
                "attribute": "af-tag-text",
                "reflect": false
            },
            "afTagIcon": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "TagMediaIcon",
                    "resolved": "TagMediaIcon.FILM | TagMediaIcon.NEWS | TagMediaIcon.PLAYLIST | TagMediaIcon.PODCAST | TagMediaIcon.WEBINAR | TagMediaIcon.WEBTV",
                    "references": {
                        "TagMediaIcon": {
                            "location": "import",
                            "path": "../../_tag/tag-media/tag-media-icon.enum",
                            "id": "src/components/_tag/tag-media/tag-media-icon.enum.ts::TagMediaIcon"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "set icon for tag"
                        }],
                    "text": "S\u00E4tter ikon f\u00F6r taggen"
                },
                "getter": false,
                "setter": false,
                "attribute": "af-tag-icon",
                "reflect": false,
                "defaultValue": "TagMediaIcon.NEWS"
            },
            "afHeading": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "The heading text"
                        }],
                    "text": "Rubrikens text"
                },
                "getter": false,
                "setter": false,
                "attribute": "af-heading",
                "reflect": false
            },
            "afHeadingLevel": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "InfoCardMultiHeadingLevel",
                    "resolved": "InfoCardMultiHeadingLevel.H1 | InfoCardMultiHeadingLevel.H2 | InfoCardMultiHeadingLevel.H3 | InfoCardMultiHeadingLevel.H4 | InfoCardMultiHeadingLevel.H5 | InfoCardMultiHeadingLevel.H6",
                    "references": {
                        "InfoCardMultiHeadingLevel": {
                            "location": "import",
                            "path": "./info-card-multi-heading-level.enum",
                            "id": "src/components/_info-card/info-card-multi/info-card-multi-heading-level.enum.ts::InfoCardMultiHeadingLevel"
                        }
                    }
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Set heading level (h1-h6)"
                        }],
                    "text": "S\u00E4tter rubrikens vikt (h1-h6)"
                },
                "getter": false,
                "setter": false,
                "attribute": "af-heading-level",
                "reflect": false
            },
            "afType": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "InfoCardMultiType",
                    "resolved": "InfoCardMultiType.ENTRY | InfoCardMultiType.MEDIA | InfoCardMultiType.RELATED",
                    "references": {
                        "InfoCardMultiType": {
                            "location": "import",
                            "path": "./info-card-multi-type.enum",
                            "id": "src/components/_info-card/info-card-multi/info-card-multi-type.enum.ts::InfoCardMultiType"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Set info card variation. Can be 'media' or 'text'."
                        }],
                    "text": "S\u00E4tter typ. Kan vara 'media' eller 'text'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-type",
                "reflect": false,
                "defaultValue": "InfoCardMultiType.MEDIA"
            },
            "afLinkHref": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Link href attribute"
                        }],
                    "text": "S\u00E4tter attributet 'href' p\u00E5 l\u00E4nken"
                },
                "getter": false,
                "setter": false,
                "attribute": "af-link-href",
                "reflect": false
            },
            "hideVisitedColor": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "If link color should change when visited"
                        }],
                    "text": "Avg\u00F6r om f\u00E4rgen p\u00E5 l\u00E4nken inte ska \u00E4ndras p\u00E5 bes\u00F6kta l\u00E4nkar"
                },
                "getter": false,
                "setter": false,
                "attribute": "hide-visited-color",
                "reflect": false
            }
        };
    }
    static get states() {
        return {
            "activeLink": {}
        };
    }
    static get events() {
        return [{
                "method": "afOnClickLink",
                "name": "afOnClickLink",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Link element's 'onclick' event"
                        }],
                    "text": "L\u00E4nkelementets 'onclick'-event"
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }];
    }
    static get elementRef() { return "hostElement"; }
    static get watchers() {
        return [{
                "propName": "afHeading",
                "methodName": "validateHeading"
            }, {
                "propName": "afHeadingLevel",
                "methodName": "validateHeading"
            }];
    }
}
