<!--

    Copyright © 2016-2019 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.

-->
<md-button ng-click="onExportRuleChain({event: $event})"
           ng-show="!isEdit"
           class="md-raised md-primary">{{ 'rulechain.export' | translate }}</md-button>
<md-button ng-click="onSetRootRuleChain({event: $event})"
           ng-show="!isEdit && !ruleChain.root"
           class="md-raised md-primary">{{ 'rulechain.set-root' | translate }}</md-button>
<md-button ng-click="onDeleteRuleChain({event: $event})"
           ng-show="!isEdit && !ruleChain.root"
           class="md-raised md-primary">{{ 'rulechain.delete' | translate }}</md-button>

<div layout="row">
    <md-button ngclipboard data-clipboard-action="copy"
               ngclipboard-success="onRuleChainIdCopied(e)"
               data-clipboard-text="{{ruleChain.id.id}}" ng-show="!isEdit"
               class="md-raised">
        <md-icon md-svg-icon="mdi:clipboard-arrow-left"></md-icon>
        <span translate>rulechain.copyId</span>
    </md-button>
</div>

<md-content class="md-padding tb-rulechain-fieldset" layout="column">
    <fieldset ng-disabled="$root.loading || !isEdit || isReadOnly">
        <md-input-container class="md-block">
            <label translate>rulechain.name</label>
            <input required name="name" ng-model="ruleChain.name">
            <div ng-messages="theForm.name.$error">
                <div translate ng-message="required">rulechain.name-required</div>
            </div>
        </md-input-container>
        <md-input-container class="md-block">
            <md-checkbox ng-disabled="$root.loading || !isEdit" aria-label="{{ 'rulechain.debug-mode' | translate }}"
                         ng-model="ruleChain.debugMode">{{ 'rulechain.debug-mode' | translate }}
            </md-checkbox>
        </md-input-container>
        <md-input-container class="md-block">
            <label translate>rulechain.description</label>
            <textarea ng-model="ruleChain.additionalInfo.description" rows="2"></textarea>
        </md-input-container>
    </fieldset>
</md-content>
