root = true

[*]
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = crlf
indent_style = space

[*.{cs,csx}]
indent_size = 4

[*.cs]
# Usings
dotnet_sort_system_directives_first = true
csharp_using_directive_placement = outside_namespace:suggestion

# Language style
csharp_style_namespace_declarations = file_scoped:warning
csharp_style_prefer_primary_constructors = true:suggestion
csharp_prefer_simple_using_statement = true:suggestion
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_prefer_braces = true:suggestion
dotnet_style_prefer_conditional_expression_over_return = false:suggestion

# private fields => _camelCase
dotnet_naming_rule.private_fields_underscore.severity = suggestion
dotnet_naming_rule.private_fields_underscore.symbols = private_fields
dotnet_naming_rule.private_fields_underscore.style = underscore_prefix
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
dotnet_naming_style.underscore_prefix.capitalization = camel_case
dotnet_naming_style.underscore_prefix.required_prefix = _

# A few analyzer rules relaxed for a homelab app (don't block the build on these)
dotnet_diagnostic.CA1848.severity = none   # LoggerMessage delegates — overkill here
dotnet_diagnostic.CA2007.severity = none   # ConfigureAwait handled by convention, not enforced
dotnet_diagnostic.CA1515.severity = none   # public types in app assemblies are fine
dotnet_diagnostic.CA1711.severity = none   # domain names may end in Flags/Enum (e.g. ReadingFlags)
dotnet_diagnostic.CA1720.severity = none   # identifiers containing type names (e.g. 'Value')
dotnet_diagnostic.CA1819.severity = none   # properties returning arrays (DTOs)

# EF Core generated migrations: don't enforce our code-style opinions on tool output.
[**/Migrations/*.cs]
generated_code = true
dotnet_diagnostic.IDE0161.severity = none
dotnet_diagnostic.IDE0300.severity = none
dotnet_diagnostic.IDE0028.severity = none
dotnet_diagnostic.CA1861.severity = none

[*.{json,yml,yaml,csproj,props,targets}]
indent_size = 2

[*.razor]
indent_size = 4
