<!--

    Copyright © 2016-2017 The Thingsboard Authors

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<tb-grid grid-configuration="vm.ruleGridConfig">
    <details-buttons tb-help="'rules'" help-container-id="help-container">
        <div id="help-container"></div>
    </details-buttons>
    <md-tabs ng-class="{'tb-headless': vm.grid.detailsConfig.isDetailsEditMode}"
             id="tabs" md-border-bottom flex class="tb-absolute-fill">
        <md-tab label="{{ 'rule.details' | translate }}">
            <tb-rule rule="vm.grid.operatingItem()"
                               is-edit="vm.grid.detailsConfig.isDetailsEditMode"
                               is-read-only="vm.grid.isDetailsReadOnly(vm.grid.operatingItem())"
                               the-form="vm.grid.detailsForm"
                               on-activate-rule="vm.activateRule(event, vm.grid.detailsConfig.currentItem)"
                               on-suspend-rule="vm.suspendRule(event, vm.grid.detailsConfig.currentItem)"
                               on-export-rule="vm.exportRule(event, vm.grid.detailsConfig.currentItem)"
                               on-delete-rule="vm.grid.deleteItem(event, vm.grid.detailsConfig.currentItem)"></tb-rule>
        </md-tab>
        <md-tab ng-if="!vm.grid.detailsConfig.isDetailsEditMode" label="{{ 'rule.events' | translate }}">
            <tb-event-table flex entity-type="vm.types.entityType.rule"
                            entity-id="vm.grid.operatingItem().id.id"
                            tenant-id="vm.grid.operatingItem().tenantId.id"
                            default-event-type="{{vm.types.eventType.lcEvent.value}}"
                            disabled-event-types="{{vm.types.eventType.alarm.value}}">
            </tb-event-table>
        </md-tab>
    </md-tabs>
</tb-grid>
