*/ class TenantConfigurationResourceEvidenceFactory extends Factory { protected $model = TenantConfigurationResourceEvidence::class; public function definition(): array { return [ 'resource_id' => TenantConfigurationResource::factory(), 'workspace_id' => fn (array $attributes): int => $this->resource($attributes)->workspace_id, 'managed_environment_id' => fn (array $attributes): int => $this->resource($attributes)->managed_environment_id, 'provider_connection_id' => fn (array $attributes): int => $this->resource($attributes)->provider_connection_id, 'resource_type_id' => fn (array $attributes): int => $this->resource($attributes)->resource_type_id, 'operation_run_id' => fn (array $attributes): int => (int) OperationRun::factory()->create([ 'workspace_id' => $this->resource($attributes)->workspace_id, 'managed_environment_id' => $this->resource($attributes)->managed_environment_id, 'type' => OperationRunType::TenantConfigurationCapture->value, 'status' => OperationRunStatus::Completed->value, 'outcome' => OperationRunOutcome::Succeeded->value, ])->getKey(), 'source_contract_key' => 'assignmentFilter', 'source_endpoint' => '/deviceManagement/assignmentFilters', 'source_version' => 'v1.0', 'source_schema_hash' => null, 'source_metadata' => ['factory' => 'tenant_configuration_resource_evidence'], 'raw_payload' => ['id' => fake()->uuid()], 'normalized_payload' => ['id' => fake()->uuid()], 'payload_hash' => hash('sha256', fake()->uuid()), 'permission_context' => ['scopes_granted' => []], 'evidence_state' => EvidenceState::ContentBacked->value, 'coverage_level' => CoverageLevel::ContentBacked->value, 'capture_outcome' => CaptureOutcome::Captured->value, 'captured_at' => now(), ]; } private function resource(array $attributes): TenantConfigurationResource { return TenantConfigurationResource::query()->findOrFail((int) $attributes['resource_id']); } }