import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { AuditRecordType, AuditService } from '@c8y/client';
import * as i0 from "@angular/core";
import * as i1 from "@c8y/client";
import * as i2 from "../common/forOf.directive";
import * as i3 from "../i18n/c8y-translate.pipe";
import * as i4 from "@angular/common";
import * as i5 from "../common/date.pipe";
/**
 * Audit log component allows to show audits list. Component fetches audit records for the source object given as input.
 *
 * **Example**
 *
 * ```html
 *  <c8y-audit-log [source]="sourceId"></c8y-audit-log>
 * ```
 */
export class AuditLogComponent {
    /**
     * @ignore
     */
    constructor(audit) {
        this.audit = audit;
    }
    /**
     * After page view is initialized, component gets audit records from auditRecords endpoint.
     */
    ngOnInit() {
        const { source, type } = this;
        this.records = this.audit.list({
            withTotalPages: true,
            source,
            type
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuditLogComponent, deps: [{ token: i1.AuditService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: AuditLogComponent, selector: "c8y-audit-log", inputs: { source: "source", type: "type" }, ngImport: i0, template: "<div class=\"inner-scroll\">\n  <ul class=\"c8y-list__group c8y-list--timeline m-t-16\">\n    <li\n      class=\"c8y-list--timeline__item\"\n      *c8yFor=\"let record of records | async\"\n    >\n      <small class=\"c8y-list--timeline__item__date\">\n        {{ record.time | c8yDate }}\n      </small>\n      <div class=\"c8y-list__item\">\n        <div class=\"c8y-list__item__block\">\n          <div class=\"c8y-list__item__body text-truncate-wrap\">\n            <div class=\"row\">\n              <div class=\"col-md-5 d-flex a-i-baseline\">\n                <span\n                  class=\"text-truncate\"\n                  title=\"{{ record.activity | translate }}\"\n                >\n                  {{ record.activity | translate }}\n                </span>\n                <small class=\"m-l-4 text-muted flex-no-shrink\">{{ record.user }}</small>\n              </div>\n              <div class=\"col-md-7\">\n                <div class=\"small text-truncate-wrap\">{{ record.text | translate }}</div>\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n    </li>\n  </ul>\n</div>\n", dependencies: [{ kind: "directive", type: i2.ForOfDirective, selector: "[c8yFor]", inputs: ["c8yForOf", "c8yForLoadMore", "c8yForPipe", "c8yForNotFound", "c8yForMaxIterations", "c8yForLoadingTemplate", "c8yForLoadNextLabel", "c8yForLoadingLabel", "c8yForRealtime", "c8yForRealtimeOptions", "c8yForComparator", "c8yForEnableVirtualScroll", "c8yForVirtualScrollElementSize", "c8yForVirtualScrollStrategy", "c8yForVirtualScrollContainerHeight"], outputs: ["c8yForCount", "c8yForChange", "c8yForLoadMoreComponent"] }, { kind: "pipe", type: i3.C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.DatePipe, name: "c8yDate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AuditLogComponent, decorators: [{
            type: Component,
            args: [{ selector: 'c8y-audit-log', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"inner-scroll\">\n  <ul class=\"c8y-list__group c8y-list--timeline m-t-16\">\n    <li\n      class=\"c8y-list--timeline__item\"\n      *c8yFor=\"let record of records | async\"\n    >\n      <small class=\"c8y-list--timeline__item__date\">\n        {{ record.time | c8yDate }}\n      </small>\n      <div class=\"c8y-list__item\">\n        <div class=\"c8y-list__item__block\">\n          <div class=\"c8y-list__item__body text-truncate-wrap\">\n            <div class=\"row\">\n              <div class=\"col-md-5 d-flex a-i-baseline\">\n                <span\n                  class=\"text-truncate\"\n                  title=\"{{ record.activity | translate }}\"\n                >\n                  {{ record.activity | translate }}\n                </span>\n                <small class=\"m-l-4 text-muted flex-no-shrink\">{{ record.user }}</small>\n              </div>\n              <div class=\"col-md-7\">\n                <div class=\"small text-truncate-wrap\">{{ record.text | translate }}</div>\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n    </li>\n  </ul>\n</div>\n" }]
        }], ctorParameters: () => [{ type: i1.AuditService }], propDecorators: { source: [{
                type: Input
            }], type: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 