# LS1007: Domain Event Is Not an Immutable Record

## Intent

LS1007 is a compiler check that reports a domain event, a record of a completed business fact, that is not an immutable record, which would let callers change the fact after it was raised. This page states what the rule reports, where the warning sits, and how to make the event an immutable record.

## Reference

### What the rule enforces

LS1007 enforces [Raise immutable domain facts](https://litespec.dev/2.0.0/backend/dotnet/domain.md#raise-immutable-domain-facts) (`litespec/backend/dotnet/domain#raise-immutable-domain-facts`). It runs in Domain only. Its category is `LiteSpec.Domain`. It reports a warning and is enabled by default, as the [Analyzers overview](https://litespec.dev/2.0.0/analyzers/README.md) describes.

### What the rule reports

The rule reports any type that implements an interface named `IDomainEvent` unless it is a record class whose name ends in `Event`, with no settable properties and no mutable instance fields. The diagnostic sits on the type name. One type gets one diagnostic even when several checks fail.

### Failing example

```csharp
public sealed record OrderPlacedEvent : IDomainEvent
{
    public string Note { get; set; } = string.Empty;
}
```

### Passing example

```csharp
public sealed record OrderPlacedEvent(OrderId OrderId) : IDomainEvent;
```

### How to fix

Make the event a record class named `{Aggregate}{PastFact}Event` that implements `IDomainEvent`, carries business data only, and exposes its members through `init` setters or readonly fields.

## Notes

### What the rule ignores

The rule does not report interfaces that merely extend `IDomainEvent`. It accepts event records with only `init` setters, `readonly` fields, `static` fields, or constants. It does not run outside Domain.
