# | Batch workflow contracts (schema definitions)
# | Migrated from: provisioning/kcl/workflows.k
# | Pattern: Pure schema definitions using Nickel contracts

{
  DependencyDef = {
    target_operation_id | String,
    dependency_type | String,
    conditions,
    timeout | Number,
    fail_on_dependency_error | Bool,
  },

  RetryPolicy = {
    max_attempts | Number,
    initial_delay | Number,
    max_delay | Number,
    backoff_multiplier | Number,
    retry_on_errors,
    retry_on_any_error | Bool,
  },

  RollbackStrategy = {
    enabled | Bool,
    strategy | String,
    preserve_partial_state | Bool,
    custom_rollback_operations,
    rollback_timeout | Number,
  },

  MonitoringConfig = {
    enabled | Bool,
    backend | String,
    collection_interval | Number,
    enable_tracing | Bool,
    log_level | String,
    enable_notifications | Bool,
    notification_channels,
    endpoint | String | optional,
  },

  StorageConfig = {
    backend | String,
    connection_config,
    base_path | String,
    enable_persistence | Bool,
    retention_hours | Number,
    enable_compression | Bool,
    encryption | Dyn | optional,
  },

  BatchOperation = {
    operation_id | String,
    name | String,
    operation_type | String,
    action | String,
    parameters,
    dependencies,
    timeout | Number,
    allow_parallel | Bool,
    priority | Number,
    validation_rules,
    success_conditions,
    provider | String | optional,
    retry_policy | Dyn | optional,
    rollback_strategy | Dyn | optional,
  },

  BatchWorkflow = {
    workflow_id | String,
    name | String,
    description | String,
    version | String,
    operations,
    max_parallel_operations | Number,
    global_timeout | Number,
    fail_fast | Bool,
    execution_context,
    pre_workflow_hooks,
    post_workflow_hooks,
    created_at | String | optional,
    modified_at | String | optional,
    storage | Dyn | optional,
    monitoring | Dyn | optional,
    default_retry_policy | Dyn | optional,
    default_rollback_strategy | Dyn | optional,
    notifications | Dyn | optional,
  },

  WorkflowExecution = {
    workflow_id | String,
    execution_id | String,
    status | String,
    operation_states,
    results,
    errors,
    resource_usage,
    rollback_history,
    started_at | String | optional,
    completed_at | String | optional,
    duration | String | optional,
  },

  WorkflowTemplate = {
    template_id | String,
    name | String,
    description | String,
    category | String,
    parameters,
    required_parameters,
    version | String,
    examples,
    workflow_template | Dyn | optional,
    min_provisioning_version | String | optional,
    documentation_url | String | optional,
  },
}
