// Package models - Rule domain models package models import "time" // Rule represents an automation rule type Rule struct { ID string Name string Description *string IsEnabled bool ADConnectionID string ObjectType string BaseDNOverride *string SearchScopeOverride *string ScheduleID *string ExecutionMode string GroupJoinOperator string MaxParallelism *int StopOnError bool LastRunUTC *time.Time LastRunResult *string CreatedUTC time.Time UpdatedUTC time.Time DeletedUTC *time.Time ConditionGroups []RuleConditionGroup Actions []RuleAction } // RuleConditionGroup represents a group of conditions type RuleConditionGroup struct { ID string RuleID string Name *string IsEnabled bool JoinOperator string SortOrder int Negate bool CreatedUTC time.Time UpdatedUTC time.Time DeletedUTC *time.Time Conditions []RuleCondition } // RuleCondition represents a single condition in a group type RuleCondition struct { ID string ConditionGroupID string IsEnabled bool AttributeName string Operator string ValueType string ComparisonValue *string CustomLdapExpression *string Negate bool SortOrder int CaseSensitive bool CreatedUTC time.Time UpdatedUTC time.Time DeletedUTC *time.Time } // RuleAction represents an action to execute when conditions match type RuleAction struct { ID string RuleID string ActionType string IsEnabled bool SortOrder int ConfigurationJSON string RollbackMode *string CreatedUTC time.Time UpdatedUTC time.Time DeletedUTC *time.Time } // RuleRun represents an execution history record type RuleRun struct { ID string RuleID string Status string StartedUTC time.Time CompletedUTC *time.Time DurationMS *int ObjectsMatched int ObjectsProcessed int ActionsExecuted int ActionsFailed int ErrorMessage *string ExecutionMode string TriggeredBy *string CreatedUTC time.Time } // RuleRunAction represents a single action execution detail type RuleRunAction struct { ID string RuleRunID string RuleActionID string ObjectDN string ActionType string Status string DetailsJSON *string ErrorMessage *string DurationMS *int CreatedUTC time.Time } // ActionConfig represents the configuration for different action types type ActionConfig struct { // AddToGroup / AddGroupToGroup TargetGroupDN string `json:"targetGroupDn,omitempty"` CreateIfMissing bool `json:"createIfMissing,omitempty"` GroupScope string `json:"groupScope,omitempty"` // Global, DomainLocal, Universal GroupType string `json:"groupType,omitempty"` // Security, Distribution GroupOU string `json:"groupOu,omitempty"` // MoveToOu TargetOU string `json:"targetOu,omitempty"` CreateOUIfMissing bool `json:"createOuIfMissing,omitempty"` // RemoveFromGroupIfNoMatch RemoveIfNoMatch bool `json:"removeIfNoMatch,omitempty"` // SyncGroupMembership: how to reconcile the target group's membership // against the matched set. One of FullSync, ManagedAdd, AddOnly. Empty // defaults to FullSync. SyncMode string `json:"syncMode,omitempty"` // Dynamic path variables UseDynamicPath bool `json:"useDynamicPath,omitempty"` PathTemplate string `json:"pathTemplate,omitempty"` } // SummaryRuleStats represents aggregated statistics for a rule type SummaryRuleStats struct { RuleID string TotalRuns int SuccessfulRuns int FailedRuns int LastRunUTC *time.Time LastRunStatus *string AvgDurationMS *int TotalObjectsProcessed int UpdatedUTC time.Time }