# Top-most EditorConfig file
root = true

[*.{cs,csx,vb,vbx}]
indent_style = space
indent_size = 4
end_of_line = crlf
insert_final_newline = true
trim_trailing_whitespace = true

# Prefer explicit typing when readability matters
csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = false:suggestion

# Brace and expression style
csharp_prefer_braces = true:warning
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_properties = when_on_single_line:suggestion

# Null checks / pattern matching
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion

# Namespace and using conventions
csharp_style_namespace_declarations = file_scoped:suggestion
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = true

# Naming rules (private fields: _camelCase)
dotnet_naming_rule.private_fields_must_be_camel_case.symbols = private_fields
dotnet_naming_rule.private_fields_must_be_camel_case.style = private_field_style
dotnet_naming_rule.private_fields_must_be_camel_case.severity = suggestion

dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private

dotnet_naming_style.private_field_style.required_prefix = _
dotnet_naming_style.private_field_style.capitalization = camel_case

# CA and IDE analyzer defaults
[*.cs]
dotnet_analyzer_diagnostic.category-Style.severity = suggestion
dotnet_analyzer_diagnostic.category-Reliability.severity = warning
dotnet_analyzer_diagnostic.category-Performance.severity = warning
dotnet_analyzer_diagnostic.category-Security.severity = warning

# Encourage explicit async naming
# IDE1006 covers naming patterns; reinforce method suffix through analyzers when present
