var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import Project from "./Project";
import Service from "./Service";
import User from "./User";
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
import Route from "../../Types/API/Route";
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
import OwnedThrough from "../../Types/Database/AccessControl/OwnedThrough";
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
import TableBillingAccessControl from "../../Types/Database/AccessControl/TableBillingAccessControl";
import CanAccessIfCanReadOn from "../../Types/Database/CanAccessIfCanReadOn";
import ColumnLength from "../../Types/Database/ColumnLength";
import ColumnType from "../../Types/Database/ColumnType";
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
import TableColumn from "../../Types/Database/TableColumn";
import TableColumnType from "../../Types/Database/TableColumnType";
import TableMetadata from "../../Types/Database/TableMetadata";
import TenantColumn from "../../Types/Database/TenantColumn";
import IconProp from "../../Types/Icon/IconProp";
import ObjectID from "../../Types/ObjectID";
import Permission from "../../Types/Permission";
import MetricPipelineRuleType from "../../Types/Metrics/MetricPipelineRuleType";
import FilterCondition from "../../Types/Filter/FilterCondition";
import { PlanType } from "../../Types/Billing/SubscriptionPlan";
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
let MetricPipelineRule = class MetricPipelineRule extends BaseModel {
    constructor() {
        super(...arguments);
        this.project = undefined;
        this.projectId = undefined;
        this.service = undefined;
        this.serviceId = undefined;
        this.name = undefined;
        this.description = undefined;
        this.ruleType = undefined;
        this.filterCondition = undefined;
        this.filters = undefined;
        this.renameFromKey = undefined;
        this.renameToKey = undefined;
        this.addAttributeKey = undefined;
        this.addAttributeValue = undefined;
        this.redactReplacement = undefined;
        this.samplePercentage = undefined;
        this.isEnabled = undefined;
        this.sortOrder = undefined;
        this.createdByUser = undefined;
        this.createdByUserId = undefined;
        this.deletedByUser = undefined;
        this.deletedByUserId = undefined;
    }
};
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectMetricPipelineRule,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "projectId",
        type: TableColumnType.Entity,
        modelType: Project,
        title: "Project",
        description: "Relation to the project this metric pipeline rule belongs to.",
    }),
    ManyToOne(() => {
        return Project;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "projectId" }),
    __metadata("design:type", Project)
], MetricPipelineRule.prototype, "project", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectMetricPipelineRule,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: true,
        canReadOnRelationQuery: true,
        title: "Project ID",
        description: "ID of the project this metric pipeline rule belongs to.",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: false,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], MetricPipelineRule.prototype, "projectId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectMetricPipelineRule,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectMetricPipelineRule,
        ],
    }),
    TableColumn({
        manyToOneRelationColumn: "serviceId",
        type: TableColumnType.Entity,
        modelType: Service,
        required: false,
        title: "Service",
        description: "Optional service scope. When set, the rule only applies to metrics for this service. Leave empty for project-wide rules.",
    }),
    ManyToOne(() => {
        return Service;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "serviceId" }),
    __metadata("design:type", Service)
], MetricPipelineRule.prototype, "service", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectMetricPipelineRule,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectMetricPipelineRule,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        title: "Service ID",
        description: "Optional service ID scoping this rule. Null means the rule is project-wide.",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], MetricPipelineRule.prototype, "serviceId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectMetricPipelineRule,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectMetricPipelineRule,
        ],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.Name,
        canReadOnRelationQuery: true,
        title: "Name",
        description: "Friendly name for this rule.",
    }),
    Column({
        nullable: false,
        type: ColumnType.Name,
        length: ColumnLength.Name,
    }),
    __metadata("design:type", String)
], MetricPipelineRule.prototype, "name", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectMetricPipelineRule,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectMetricPipelineRule,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.LongText,
        canReadOnRelationQuery: true,
        title: "Description",
        description: "Description of what this rule does.",
    }),
    Column({
        nullable: true,
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
    }),
    __metadata("design:type", String)
], MetricPipelineRule.prototype, "description", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectMetricPipelineRule,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectMetricPipelineRule,
        ],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.ShortText,
        canReadOnRelationQuery: true,
        title: "Rule Type",
        description: "One of: Filter, Drop, RenameMetric, RenameAttribute, AddAttribute, RemoveAttribute, RedactAttribute, Sample.",
    }),
    Column({
        nullable: false,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], MetricPipelineRule.prototype, "ruleType", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectMetricPipelineRule,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectMetricPipelineRule,
        ],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.ShortText,
        title: "Filter Condition",
        description: "How to combine filters: 'All' requires every filter to match (AND), 'Any' requires at least one to match (OR).",
        defaultValue: FilterCondition.All,
    }),
    Column({
        nullable: false,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        default: FilterCondition.All,
    }),
    __metadata("design:type", String)
], MetricPipelineRule.prototype, "filterCondition", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectMetricPipelineRule,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectMetricPipelineRule,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.JSON,
        title: "Filters",
        description: "List of filters evaluated against each metric data point. An empty list matches every data point.",
    }),
    Column({
        nullable: true,
        type: ColumnType.JSON,
    }),
    __metadata("design:type", Array)
], MetricPipelineRule.prototype, "filters", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectMetricPipelineRule,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectMetricPipelineRule,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.ShortText,
        title: "Rename From Key",
        description: "For RenameMetric: the existing metric name. For RenameAttribute: the existing attribute key.",
    }),
    Column({
        nullable: true,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], MetricPipelineRule.prototype, "renameFromKey", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectMetricPipelineRule,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectMetricPipelineRule,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.ShortText,
        title: "Rename To Key",
        description: "For RenameMetric: the new metric name. For RenameAttribute: the new attribute key.",
    }),
    Column({
        nullable: true,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], MetricPipelineRule.prototype, "renameToKey", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectMetricPipelineRule,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectMetricPipelineRule,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.ShortText,
        title: "Add Attribute Key",
        description: "For AddAttribute / RemoveAttribute / RedactAttribute: the attribute key to act on.",
    }),
    Column({
        nullable: true,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], MetricPipelineRule.prototype, "addAttributeKey", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectMetricPipelineRule,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectMetricPipelineRule,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.LongText,
        title: "Add Attribute Value",
        description: "For AddAttribute: the attribute value to set.",
    }),
    Column({
        nullable: true,
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
    }),
    __metadata("design:type", String)
], MetricPipelineRule.prototype, "addAttributeValue", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectMetricPipelineRule,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectMetricPipelineRule,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.ShortText,
        title: "Redact Replacement",
        description: "For RedactAttribute: the literal string to replace the value with. Defaults to [REDACTED].",
    }),
    Column({
        nullable: false,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        default: "[REDACTED]",
    }),
    __metadata("design:type", String)
], MetricPipelineRule.prototype, "redactReplacement", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectMetricPipelineRule,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectMetricPipelineRule,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.Number,
        title: "Sample Percentage",
        description: "For Sample: percentage of matched rows to keep (0-100). 100 keeps all.",
        defaultValue: 100,
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        default: 100,
    }),
    __metadata("design:type", Number)
], MetricPipelineRule.prototype, "samplePercentage", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectMetricPipelineRule,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectMetricPipelineRule,
        ],
    }),
    Index(),
    TableColumn({
        required: true,
        type: TableColumnType.Boolean,
        canReadOnRelationQuery: true,
        title: "Enabled",
        description: "Whether this rule is active.",
        defaultValue: true,
    }),
    Column({
        nullable: false,
        type: ColumnType.Boolean,
        default: true,
    }),
    __metadata("design:type", Boolean)
], MetricPipelineRule.prototype, "isEnabled", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectMetricPipelineRule,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectMetricPipelineRule,
        ],
    }),
    TableColumn({
        title: "Sort Order",
        required: false,
        type: TableColumnType.Number,
        canReadOnRelationQuery: true,
        description: "Evaluation order within its scope (service-level or project-level).",
        defaultValue: 0,
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        default: 0,
    }),
    __metadata("design:type", Number)
], MetricPipelineRule.prototype, "sortOrder", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "createdByUserId",
        type: TableColumnType.Entity,
        modelType: User,
        title: "Created By User",
        description: "Relation to the user who created this rule.",
    }),
    ManyToOne(() => {
        return User;
    }, {
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "createdByUserId" }),
    __metadata("design:type", User)
], MetricPipelineRule.prototype, "createdByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.ObjectID,
        title: "Created By User ID",
        description: "ID of the user who created this rule.",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], MetricPipelineRule.prototype, "createdByUserId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "deletedByUserId",
        type: TableColumnType.Entity,
        modelType: User,
        title: "Deleted By User",
        description: "Relation to the user who deleted this rule.",
    }),
    ManyToOne(() => {
        return User;
    }, {
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "deletedByUserId" }),
    __metadata("design:type", User)
], MetricPipelineRule.prototype, "deletedByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.ObjectID,
        title: "Deleted By User ID",
        description: "ID of the user who deleted this rule.",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], MetricPipelineRule.prototype, "deletedByUserId", void 0);
MetricPipelineRule = __decorate([
    EnableDocumentation(),
    CanAccessIfCanReadOn("service"),
    TableBillingAccessControl({
        create: PlanType.Free,
        read: PlanType.Free,
        update: PlanType.Free,
        delete: PlanType.Free,
    }),
    TenantColumn("projectId"),
    CrudApiEndpoint(new Route("/metric-pipeline-rule")),
    OwnedThrough("serviceId", Service),
    Entity({
        name: "MetricPipelineRule",
    }),
    TableMetadata({
        tableName: "MetricPipelineRule",
        singularName: "Metric Pipeline Rule",
        pluralName: "Metric Pipeline Rules",
        icon: IconProp.Filter,
        tableDescription: "Rules applied at metric ingest time to filter, drop, rename, enrich, redact, or sample metric data points.",
    }),
    TableAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectMetricPipelineRule,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.TelemetryAdmin,
            Permission.TelemetryMember,
            Permission.TelemetryViewer,
            Permission.ReadProjectMetricPipelineRule,
        ],
        delete: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.DeleteProjectMetricPipelineRule,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectMetricPipelineRule,
        ],
    })
], MetricPipelineRule);
export default MetricPipelineRule;
//# sourceMappingURL=MetricPipelineRule.js.map