/**
 * Copyright (C) 2022 Robert Bosch GmbH Copyright (C) 2022 Robert Bosch Manufacturing Solutions GmbH, Germany. All rights reserved.
 */
import { Component, Input, OnInit } from '@angular/core';

/**
 * Interface to provide options while creating a link
 */
export interface LinkOptions {
    /** link url to navigate or open in new tab */
    url: string, 
    /** link type values default, primary, labelIcon, inline */
    type?: string,
    /** name of the icon if any */
    iconName?: string,
    /** position of the icon w.r.t label values left, right */
    iconPosition?: string,
    /** fontsize which takes value as 12, 16, etc */
    fontsize?: number,
    /** link disabled eg. true or false */
    disabled?: boolean
}

@Component({
    selector: 'bci-link',
    templateUrl: './bci-link.component.html',
    styleUrls: ['./bci-link.component.scss'],
})
export class BciLinkComponent implements OnInit{
    /** options for styling link */
    @Input() linkOptions: LinkOptions;

    ngOnInit(): void {

        // Default values
        (this.linkOptions!=undefined && !this.linkOptions.type) && (this.linkOptions.type = 'default');
        (this.linkOptions!=undefined && !this.linkOptions.iconPosition) && (this.linkOptions.iconPosition = 'left');
        (this.linkOptions!=undefined && !this.linkOptions.fontsize) && (this.linkOptions.fontsize = 16);
    }
}