/**
 * Created by jd on 10/02/2016.
 */
import {NgIf} from "@angular/common";
import {Component, Input, Output, EventEmitter, OnInit, ViewEncapsulation} from "@angular/core";

import {RippleEffect} from "../ripple-effect/RippleEffect";
import {CoreIcon} from "../core-icon/core-icon";

@Component(
    {
        selector: "core-button",
        templateUrl: "node_modules/bia-framework/components/core-button/core-button.template.html",
        styleUrls: ['node_modules/bia-framework/components/core-button/core-button.style.css'],
        encapsulation: ViewEncapsulation.None,
        directives: [NgIf, CoreIcon, RippleEffect]
    }
)
export class CoreButton implements OnInit
{
    //If is a normal button or submit button
    @Input()
    clickBehavior:string;
    //Text of the Button
    @Input()
    text:string;
    //Type of odisseia button, flat, raised, float or icon
    @Input()
    type:string;
    //Applicable if float. Position, float left, right bottom or top
    @Input()
    float:string;
    //Color of the button
    @Input()
    color:string;
    
    //Control if the button is Disabled
    @Input()
    isDisabled:boolean;

    @Input()
    icon:string;

    @Input()
    iconColor:string;
    //Click command of the Button

    @Input()
    iconPlace:string;

    @Output()
    commmand = new EventEmitter();

    constructor()
    {
    }

    ngOnInit():any
    {
        this.clickBehavior = this.clickBehavior || "normal";
        this.iconPlace = this.iconPlace || "rows";
        this.type = this.type || "flat";
    }

    public onButtonClick = (event:Event):void =>
    {
        this.commmand.emit(event);
    }


}