001// --------------------------------------------------------------------------------
002// Copyright 2002-2025 Echo Three, LLC
003//
004// Licensed under the Apache License, Version 2.0 (the "License");
005// you may not use this file except in compliance with the License.
006// You may obtain a copy of the License at
007//
008//     http://www.apache.org/licenses/LICENSE-2.0
009//
010// Unless required by applicable law or agreed to in writing, software
011// distributed under the License is distributed on an "AS IS" BASIS,
012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013// See the License for the specific language governing permissions and
014// limitations under the License.
015// --------------------------------------------------------------------------------
016
017package com.echothree.model.control.search.server.graphql;
018
019import com.echothree.model.control.core.server.graphql.CoreSecurityUtils;
020import com.echothree.model.control.core.server.graphql.EntityAttributeObject;
021import com.echothree.model.data.core.server.entity.EntityAttribute;
022import graphql.annotations.annotationTypes.GraphQLDescription;
023import graphql.annotations.annotationTypes.GraphQLField;
024import graphql.annotations.annotationTypes.GraphQLName;
025import graphql.schema.DataFetchingEnvironment;
026import java.util.Collection;
027
028@GraphQLDescription("user visit search facet object")
029@GraphQLName("UserVisitSearchFacet")
030public class UserVisitSearchFacetObject {
031
032    final private EntityAttribute entityAttribute;
033    final private Collection<UserVisitSearchFacetListItemObject> userVisitSearchFacetListItems;
034    final private Collection<UserVisitSearchFacetIntegerObject> userVisitSearchFacetIntegers;
035    final private Collection<UserVisitSearchFacetLongObject> userVisitSearchFacetLongs;
036
037    /** Creates a new instance of UserVisitSearchFacetIntegerObject */
038    public UserVisitSearchFacetObject(EntityAttribute entityAttribute, Collection<UserVisitSearchFacetListItemObject> userVisitSearchFacetListItems,
039            Collection<UserVisitSearchFacetIntegerObject> userVisitSearchFacetIntegers, Collection<UserVisitSearchFacetLongObject> userVisitSearchFacetLongs) {
040        this.entityAttribute = entityAttribute;
041        this.userVisitSearchFacetListItems = userVisitSearchFacetListItems;
042        this.userVisitSearchFacetIntegers = userVisitSearchFacetIntegers;
043        this.userVisitSearchFacetLongs = userVisitSearchFacetLongs;
044    }
045
046    @GraphQLField
047    @GraphQLDescription("entity attribute")
048    public EntityAttributeObject getEntityAttribute(final DataFetchingEnvironment env) {
049        return CoreSecurityUtils.getHasEntityAttributeAccess(env) ? new EntityAttributeObject(entityAttribute, null) : null;
050    }
051
052    @GraphQLField
053    @GraphQLDescription("entity list items")
054    public Collection<UserVisitSearchFacetListItemObject> getEntityListItems() {
055        return userVisitSearchFacetListItems;
056    }
057
058    @GraphQLField
059    @GraphQLDescription("entity integer ranges")
060    public Collection<UserVisitSearchFacetIntegerObject> getEntityIntegerRanges() {
061        return userVisitSearchFacetIntegers;
062    }
063
064    @GraphQLField
065    @GraphQLDescription("entity long ranges")
066    public Collection<UserVisitSearchFacetLongObject> getEntityLongRanges() {
067        return userVisitSearchFacetLongs;
068    }
069
070}