diff --git a/Dfe.Data.SearchPrototype/SearchForEstablishments/Models/EstablishmentFacet.cs b/Dfe.Data.SearchPrototype/SearchForEstablishments/Models/EstablishmentFacet.cs new file mode 100644 index 0000000..8bfb94a --- /dev/null +++ b/Dfe.Data.SearchPrototype/SearchForEstablishments/Models/EstablishmentFacet.cs @@ -0,0 +1,29 @@ +namespace Dfe.Data.SearchPrototype.SearchForEstablishments.Models; + +/// +/// The object that encapsulates the Faceted results returned by the +/// T:Dfe.Data.SearchPrototype.SearchForEstablishments.SearchByKeywordUseCase instance +/// +public class EstablishmentFacet +{ + /// + /// The facet (field) name + /// + public string Name { get; } + + /// + /// The collection of T:Dfe.Data.SearchPrototype.SearchForEstablishments.Models.FacetResult + /// + public IList Results { get; } + + /// + /// Constructor + /// + /// + /// + public EstablishmentFacet(string facetName, IList facetResults) + { + Name = facetName; + Results = facetResults; + } +} diff --git a/Dfe.Data.SearchPrototype/SearchForEstablishments/Models/EstablishmentStatusCode.cs b/Dfe.Data.SearchPrototype/SearchForEstablishments/Models/EstablishmentStatusCode.cs deleted file mode 100644 index adb76d5..0000000 --- a/Dfe.Data.SearchPrototype/SearchForEstablishments/Models/EstablishmentStatusCode.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Dfe.Data.SearchPrototype.SearchForEstablishments.Models; - -public enum EstablishmentStatusCode -{ - Closed = 0, - Open = 1, - Unknown -} \ No newline at end of file diff --git a/Dfe.Data.SearchPrototype/SearchForEstablishments/Models/FacetResult.cs b/Dfe.Data.SearchPrototype/SearchForEstablishments/Models/FacetResult.cs new file mode 100644 index 0000000..b4fc27c --- /dev/null +++ b/Dfe.Data.SearchPrototype/SearchForEstablishments/Models/FacetResult.cs @@ -0,0 +1,28 @@ +namespace Dfe.Data.SearchPrototype.SearchForEstablishments.Models; + +/// +/// The object that encapsulates a single facet result for a facet +/// +public class FacetResult +{ + /// + /// The value of the facet result + /// + public string Value { get; } + + /// + /// The number of records that belong to this facet value + /// + public int? Count { get; } + + /// + /// Constructor + /// + /// The value of the facet result + /// The number of records that belong to this facet value + public FacetResult(string value, int? count) + { + Value = value; + Count = count; + } +} diff --git a/Dfe.Data.SearchPrototype/SearchForEstablishments/SearchByKeywordResponse.cs b/Dfe.Data.SearchPrototype/SearchForEstablishments/SearchByKeywordResponse.cs index 369f384..e3abd67 100644 --- a/Dfe.Data.SearchPrototype/SearchForEstablishments/SearchByKeywordResponse.cs +++ b/Dfe.Data.SearchPrototype/SearchForEstablishments/SearchByKeywordResponse.cs @@ -2,10 +2,12 @@ namespace Dfe.Data.SearchPrototype.SearchForEstablishments; + + + /// /// This is the object that carries the response (output) back from the /// T:Dfe.Data.SearchPrototype.SearchForEstablishments.SearchByKeywordUseCase instance. -/// The response will encapsulate any search results found along with a status. /// public sealed class SearchByKeywordResponse { @@ -13,6 +15,16 @@ public sealed class SearchByKeywordResponse /// The readonly collection of T:Dfe.Data.SearchPrototype.Search.Establishment search results. /// public IReadOnlyCollection EstablishmentResults { get;} + + /// + /// The readonly collection of T:Dfe.Data.SearchPrototype.Search.EstablishmentFacet returned by the Establishment search + /// + public IReadOnlyCollection? EstablishmentFacetResults { get; } + + /// + /// The return status of the call to the + /// T:Dfe.Data.SearchPrototype.SearchForEstablishments.SearchByKeywordUseCase instance + /// public SearchResponseStatus Status { get; set; } /// @@ -30,8 +42,12 @@ public SearchByKeywordResponse() /// /// The readonly collection of T:Dfe.Data.SearchPrototype.Search.Establishment search results. /// - public SearchByKeywordResponse(IReadOnlyCollection establishments) + /// + /// The readonly collection of T:Dfe.Data.SearchPrototype.Search.EstablishmentFacet + /// + public SearchByKeywordResponse(IReadOnlyCollection establishments, IReadOnlyCollection? facetResults = null) { EstablishmentResults = establishments; + EstablishmentFacetResults = facetResults; } } diff --git a/Dfe.Data.SearchPrototype/SearchForEstablishments/SearchResponseStatus.cs b/Dfe.Data.SearchPrototype/SearchForEstablishments/SearchResponseStatus.cs index 623f2f0..ad82ae9 100644 --- a/Dfe.Data.SearchPrototype/SearchForEstablishments/SearchResponseStatus.cs +++ b/Dfe.Data.SearchPrototype/SearchForEstablishments/SearchResponseStatus.cs @@ -1,8 +1,20 @@ namespace Dfe.Data.SearchPrototype.SearchForEstablishments; +/// +/// The status of the search response +/// public enum SearchResponseStatus { + /// + /// The search request completed successfully + /// Success, + /// + /// The request was not valid + /// InvalidRequest, + /// + /// The request was submitted and resulted in an error + /// SearchServiceError }