diff --git a/BuildingBlock.Inventory.slnx b/BuildingBlock.Inventory.slnx new file mode 100644 index 0000000..2dafc79 --- /dev/null +++ b/BuildingBlock.Inventory.slnx @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/docs/architecture/inventory-contract-boundary.puml b/docs/architecture/inventory-contract-boundary.puml new file mode 100644 index 0000000..b9b5d0d --- /dev/null +++ b/docs/architecture/inventory-contract-boundary.puml @@ -0,0 +1,19 @@ +@startuml +skinparam packageStyle rectangle + +package "building-block-inventory" { + package "BuildingBlock.Inventory.Contracts" { + class Requests + class Responses + interface Abstractions + } +} + +package "furniture-service" as FurnitureService +package "furniture-bff" as FurnitureBff + +FurnitureService --> Requests +FurnitureService --> Responses +FurnitureBff --> Requests +FurnitureBff --> Responses +@enduml diff --git a/docs/contracts/inventory-contract-catalog.md b/docs/contracts/inventory-contract-catalog.md new file mode 100644 index 0000000..40a05be --- /dev/null +++ b/docs/contracts/inventory-contract-catalog.md @@ -0,0 +1,17 @@ +# Inventory Contract Catalog + +## Package + +- `BuildingBlock.Inventory.Contracts` + +## Current Contract Groups + +- `Requests`: capability request shapes for inventory use cases. +- `Responses`: capability response shapes for inventory use cases. +- `Abstractions`: marker abstractions for inventory contract ownership. + +## Ownership Boundary + +- This repository owns inventory capability contracts only. +- Implementation details stay in furniture-service, furniture-bff, or furniture-dal. +- Identity abstractions are out of scope and remain Thalos-owned. diff --git a/docs/contracts/inventory-versioning-policy.md b/docs/contracts/inventory-versioning-policy.md new file mode 100644 index 0000000..fcb862c --- /dev/null +++ b/docs/contracts/inventory-versioning-policy.md @@ -0,0 +1,12 @@ +# Inventory Versioning Policy + +## Policy + +- Contract changes follow additive-first evolution. +- Breaking changes require a new major package version. +- Deprecated members should remain for at least one release cycle. + +## Compatibility Notes + +- Consumer repositories (`furniture-service`, `furniture-bff`) should update contracts explicitly. +- Transport adapters remain outside this contracts package. diff --git a/src/BuildingBlock.Inventory.Contracts/Abstractions/IInventoryCapabilityContract.cs b/src/BuildingBlock.Inventory.Contracts/Abstractions/IInventoryCapabilityContract.cs new file mode 100644 index 0000000..1e5813a --- /dev/null +++ b/src/BuildingBlock.Inventory.Contracts/Abstractions/IInventoryCapabilityContract.cs @@ -0,0 +1,8 @@ +namespace BuildingBlock.Inventory.Contracts.Abstractions; + +/// +/// Marker contract for inventory capability request/response definitions. +/// +public interface IInventoryCapabilityContract +{ +} diff --git a/src/BuildingBlock.Inventory.Contracts/BuildingBlock.Inventory.Contracts.csproj b/src/BuildingBlock.Inventory.Contracts/BuildingBlock.Inventory.Contracts.csproj new file mode 100644 index 0000000..6c3a887 --- /dev/null +++ b/src/BuildingBlock.Inventory.Contracts/BuildingBlock.Inventory.Contracts.csproj @@ -0,0 +1,7 @@ + + + net10.0 + enable + enable + + diff --git a/src/BuildingBlock.Inventory.Contracts/Requests/InventoryItemLookupRequest.cs b/src/BuildingBlock.Inventory.Contracts/Requests/InventoryItemLookupRequest.cs new file mode 100644 index 0000000..fceb943 --- /dev/null +++ b/src/BuildingBlock.Inventory.Contracts/Requests/InventoryItemLookupRequest.cs @@ -0,0 +1,7 @@ +namespace BuildingBlock.Inventory.Contracts.Requests; + +/// +/// Represents the contract request to lookup an inventory item. +/// +/// External item identifier. +public sealed record InventoryItemLookupRequest(string ItemCode); diff --git a/src/BuildingBlock.Inventory.Contracts/Responses/InventoryItemLookupResponse.cs b/src/BuildingBlock.Inventory.Contracts/Responses/InventoryItemLookupResponse.cs new file mode 100644 index 0000000..c612e5a --- /dev/null +++ b/src/BuildingBlock.Inventory.Contracts/Responses/InventoryItemLookupResponse.cs @@ -0,0 +1,8 @@ +namespace BuildingBlock.Inventory.Contracts.Responses; + +/// +/// Represents the contract response for an inventory item lookup. +/// +/// External item identifier. +/// Current quantity available. +public sealed record InventoryItemLookupResponse(string ItemCode, int QuantityAvailable); diff --git a/tests/BuildingBlock.Inventory.Contracts.UnitTests/BuildingBlock.Inventory.Contracts.UnitTests.csproj b/tests/BuildingBlock.Inventory.Contracts.UnitTests/BuildingBlock.Inventory.Contracts.UnitTests.csproj new file mode 100644 index 0000000..9a7db02 --- /dev/null +++ b/tests/BuildingBlock.Inventory.Contracts.UnitTests/BuildingBlock.Inventory.Contracts.UnitTests.csproj @@ -0,0 +1,20 @@ + + + net10.0 + enable + enable + false + + + + + + + + + + + + + + diff --git a/tests/BuildingBlock.Inventory.Contracts.UnitTests/ContractShapeTests.cs b/tests/BuildingBlock.Inventory.Contracts.UnitTests/ContractShapeTests.cs new file mode 100644 index 0000000..e1bbe17 --- /dev/null +++ b/tests/BuildingBlock.Inventory.Contracts.UnitTests/ContractShapeTests.cs @@ -0,0 +1,24 @@ +using BuildingBlock.Inventory.Contracts.Requests; +using BuildingBlock.Inventory.Contracts.Responses; + +namespace BuildingBlock.Inventory.Contracts.UnitTests; + +public class ContractShapeTests +{ + [Fact] + public void InventoryItemLookupRequest_WhenCreated_StoresItemCode() + { + var request = new InventoryItemLookupRequest("SKU-001"); + + Assert.Equal("SKU-001", request.ItemCode); + } + + [Fact] + public void InventoryItemLookupResponse_WhenCreated_StoresContractData() + { + var response = new InventoryItemLookupResponse("SKU-001", 5); + + Assert.Equal("SKU-001", response.ItemCode); + Assert.Equal(5, response.QuantityAvailable); + } +}