import { Component, Input, Output, EventEmitter } from "@angular/core";

@Component({
    selector: "odoo-list-header",
    templateUrl: "odoo-list-header.html"
})
export class OdooListHeader {

    searchMode: boolean;

    @Input()
    title: string;

    @Output()
    toggle: EventEmitter<any>;

    @Output()
    search: EventEmitter<any>;

    constructor() { 
        this.searchMode = false;
        this.toggle = new EventEmitter();
        this.search = new EventEmitter();
    }

    /**
     *
     */
    toggleSearch(): void {
        this.searchMode = !this.searchMode;
        this.toggle.emit();
    }

    /**
     *
     */
    isSearchMode(): boolean {
        return this.searchMode;
    }

    /**
     *
     */
    searchInput(event): void {
        this.search.emit(event);
    } 
}