namespace MiGu.Server.Wms;

// API / 读模型 DTO（留在 Server，不进 MiGu.DB）。请求字段中的状态仍为 string，由 Service 解析为枚举后写入实体。

public sealed record InventoryMaterialRow(
    Guid MaterialId, string MaterialCode, string MaterialName, string MaterialBarcode, string MaterialTypeCode,
    Guid ContainerId, string ContainerCode, string ContainerName,
    Guid? StorageId, string StorageCode, string StorageName,
    Guid? AreaId, string AreaCode, string AreaName,
    string LocationType, DateTimeOffset BoundAt);

public sealed record ContainerLocationSnapshot(
    Guid Id, Guid ContainerId, string LocationType, string LocationId, string LocationCode, string LocationName,
    string Status, DateTimeOffset EnteredAt, long Version);

public sealed record ContainerMaterialSnapshot(
    Guid Id, Guid ContainerId, Guid MaterialId, decimal Quantity, string BatchNo, string SerialNo, string Status,
    DateTimeOffset BoundAt, DateTimeOffset LoadedAt, DateTimeOffset? UnloadedAt, long Version);

public abstract record CommonRequest(Guid? Id, long? Version, bool IsLock, string Remark, string Extend);

public sealed record MasterDataRequest(
    Guid? Id, long? Version, string Code, string Name, string Type, string Status, bool Enabled, int SortOrder,
    bool IsLock, string Remark, string Extend) : CommonRequest(Id, Version, IsLock, Remark, Extend);

public sealed record AreaRequest(
    Guid? Id, long? Version, Guid? WarehouseId, string Code, string Name, string Type, string LayoutMode, string State,
    bool Enabled, int SortOrder, bool IsLock, string Remark, string Extend) : CommonRequest(Id, Version, IsLock, Remark, Extend);

public sealed record StorageRequest(
    Guid? Id, long? Version, Guid AreaId, string Code, string Name, string StorageType, string LocationKind,
    int ColumnNo, int LevelNo, int DepthNo, string SiteId, string SiteCode, string Barcode, int Capacity,
    string Status, string Usage, int Priority, string ZoneCode, bool AllowInbound, bool AllowOutbound, bool Enabled,
    bool IsLock, string Remark, string Extend) : CommonRequest(Id, Version, IsLock, Remark, Extend);

public sealed record GenerateBinsRequest(int ColumnFrom, int ColumnTo, int LevelFrom, int LevelTo, int DepthFrom, int DepthTo, string? CodePattern);

public sealed record ContainerRequest(
    Guid? Id, long? Version, Guid? AreaId, string Code, string Name, string Type, string Status, string Barcode,
    double Length, double Width, double Height, bool Enabled, bool IsLock, string Remark, string Extend)
    : CommonRequest(Id, Version, IsLock, Remark, Extend);

public sealed record MaterialTypeRequest(
    Guid? Id, long? Version, string Code, string Name, string Spec, string Unit, string Category, string BarcodePrefix,
    bool Enabled, bool IsLock, string Remark, string Extend) : CommonRequest(Id, Version, IsLock, Remark, Extend);

public sealed record MaterialRequest(
    Guid? Id, long? Version, string Code, string Name, string TypeCode, string Barcode, string Spec, string Unit,
    string Category, string LifecycleStatus, bool Enabled, bool IsLock, string Remark, string Extend)
    : CommonRequest(Id, Version, IsLock, Remark, Extend);

public sealed record ContainerLocationRequest(
    Guid? Id, long? Version, Guid ContainerId, string LocationType, string LocationId, string Status,
    DateTimeOffset? EnteredAt, string Source, string Reason, bool IsLock, string Remark, string Extend)
    : CommonRequest(Id, Version, IsLock, Remark, Extend);

public sealed record BindMaterialRequest(
    Guid? Id, long? Version, Guid ContainerId, Guid MaterialId, string Source, string Reason,
    bool IsLock, string Remark, string Extend) : CommonRequest(Id, Version, IsLock, Remark, Extend);

public sealed record ContainerMaterialRequest(
    Guid? Id, long? Version, Guid ContainerId, Guid MaterialId, decimal Quantity, string BatchNo, string SerialNo,
    string Status, DateTimeOffset? LoadedAt, DateTimeOffset? UnloadedAt, string Source, string Reason,
    bool IsLock, string Remark, string Extend) : CommonRequest(Id, Version, IsLock, Remark, Extend);
