// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

syntax = "proto3";

package google.cloud.talent.v4beta1;

import "google/api/annotations.proto";
import "google/api/field_behavior.proto";
import "google/cloud/talent/v4beta1/common.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "google/type/date.proto";
import "google/type/latlng.proto";
import "google/type/timeofday.proto";

option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent";
option java_multiple_files = true;
option java_outer_classname = "FiltersProto";
option java_package = "com.google.cloud.talent.v4beta1";
option objc_class_prefix = "CTS";

// The query required to perform a search query.
message JobQuery {
  // The query string that matches against the job title, description, and
  // location fields.
  //
  // The maximum number of allowed characters is 255.
  string query = 1;

  // The language code of [query][google.cloud.talent.v4beta1.JobQuery.query].
  // For example, "en-US". This field helps to better interpret the query.
  //
  // If a value isn't specified, the query language code is automatically
  // detected, which may not be accurate.
  //
  // Language code should be in BCP-47 format, such as "en-US" or "sr-Latn".
  // For more information, see
  // [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47).
  string query_language_code = 14;

  // This filter specifies the company entities to search against.
  //
  // If a value isn't specified, jobs are searched for against all
  // companies.
  //
  // If multiple values are specified, jobs are searched against the
  // companies specified.
  //
  // The format is
  // "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}". For
  // example, "projects/foo/tenants/bar/companies/baz".
  //
  // If tenant id is unspecified, the default tenant is used. For
  // example, "projects/foo/companies/bar".
  //
  // At most 20 company filters are allowed.
  repeated string companies = 2;

  // The location filter specifies geo-regions containing the jobs to
  // search against. See
  // [LocationFilter][google.cloud.talent.v4beta1.LocationFilter] for more
  // information.
  //
  // If a location value isn't specified, jobs fitting the other search
  // criteria are retrieved regardless of where they're located.
  //
  // If multiple values are specified, jobs are retrieved from any of the
  // specified locations. If different values are specified for the
  // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles]
  // parameter, the maximum provided distance is used for all locations.
  //
  // At most 5 location filters are allowed.
  repeated LocationFilter location_filters = 3;

  // The category filter specifies the categories of jobs to search against.
  // See [JobCategory][google.cloud.talent.v4beta1.JobCategory] for more
  // information.
  //
  // If a value isn't specified, jobs from any category are searched against.
  //
  // If multiple values are specified, jobs from any of the specified
  // categories are searched against.
  repeated JobCategory job_categories = 4;

  // Allows filtering jobs by commute time with different travel methods (for
  //  example, driving or public transit).
  //
  // Note: This only works when you specify a
  // [CommuteMethod][google.cloud.talent.v4beta1.CommuteMethod]. In this case,
  // [location_filters][google.cloud.talent.v4beta1.JobQuery.location_filters]
  // is ignored.
  //
  //  Currently we don't support sorting by commute time.
  CommuteFilter commute_filter = 5;

  // This filter specifies the exact company
  // [Company.display_name][google.cloud.talent.v4beta1.Company.display_name] of
  // the jobs to search against.
  //
  // If a value isn't specified, jobs within the search results are
  // associated with any company.
  //
  // If multiple values are specified, jobs within the search results may be
  // associated with any of the specified companies.
  //
  // At most 20 company display name filters are allowed.
  repeated string company_display_names = 6;

  // This search filter is applied only to
  // [Job.compensation_info][google.cloud.talent.v4beta1.Job.compensation_info].
  // For example, if the filter is specified as "Hourly job with per-hour
  // compensation > $15", only jobs meeting these criteria are searched. If a
  // filter isn't defined, all open jobs are searched.
  CompensationFilter compensation_filter = 7;

  // This filter specifies a structured syntax to match against the
  // [Job.custom_attributes][google.cloud.talent.v4beta1.Job.custom_attributes]
  // marked as `filterable`.
  //
  // The syntax for this expression is a subset of SQL syntax.
  //
  // Supported operators are: `=`, `!=`, `<`, `<=`, `>`, and `>=` where the
  // left of the operator is a custom field key and the right of the operator
  // is a number or a quoted string. You must escape backslash (\\) and
  // quote (\") characters.
  //
  // Supported functions are `LOWER([field_name])` to
  // perform a case insensitive match and `EMPTY([field_name])` to filter on the
  // existence of a key.
  //
  // Boolean expressions (AND/OR/NOT) are supported up to 3 levels of
  // nesting (for example, "((A AND B AND C) OR NOT D) AND E"), a maximum of 100
  // comparisons or functions are allowed in the expression. The expression
  // must be < 6000 bytes in length.
  //
  // Sample Query:
  // `(LOWER(driving_license)="class \"a\"" OR EMPTY(driving_license)) AND
  // driving_years > 10`
  string custom_attribute_filter = 8;

  // This flag controls the spell-check feature. If false, the
  // service attempts to correct a misspelled query,
  // for example, "enginee" is corrected to "engineer".
  //
  // Defaults to false: a spell check is performed.
  bool disable_spell_check = 9;

  // The employment type filter specifies the employment type of jobs to
  // search against, such as
  // [EmploymentType.FULL_TIME][google.cloud.talent.v4beta1.EmploymentType.FULL_TIME].
  //
  // If a value isn't specified, jobs in the search results includes any
  // employment type.
  //
  // If multiple values are specified, jobs in the search results include
  // any of the specified employment types.
  repeated EmploymentType employment_types = 10;

  // This filter specifies the locale of jobs to search against,
  // for example, "en-US".
  //
  // If a value isn't specified, the search results can contain jobs in any
  // locale.
  //
  //
  // Language codes should be in BCP-47 format, such as "en-US" or "sr-Latn".
  // For more information, see
  // [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47).
  //
  // At most 10 language code filters are allowed.
  repeated string language_codes = 11;

  // Jobs published within a range specified by this filter are searched
  // against.
  TimestampRange publish_time_range = 12;

  // This filter specifies a list of job names to be excluded during search.
  //
  // At most 400 excluded job names are allowed.
  repeated string excluded_jobs = 13;
}

// Filters to apply when performing the search query.
message ProfileQuery {
  // Keywords to match any text fields of profiles.
  //
  // For example, "software engineer in Palo Alto".
  string query = 1;

  // The location filter specifies geo-regions containing the profiles to
  // search against.
  //
  // One of
  // [LocationFilter.address][google.cloud.talent.v4beta1.LocationFilter.address]
  // or
  // [LocationFilter.lat_lng][google.cloud.talent.v4beta1.LocationFilter.lat_lng]
  // must be provided or an error is thrown. If both
  // [LocationFilter.address][google.cloud.talent.v4beta1.LocationFilter.address]
  // and
  // [LocationFilter.lat_lng][google.cloud.talent.v4beta1.LocationFilter.lat_lng]
  // are provided, an error is thrown.
  //
  // The following logic is used to determine which locations in
  // the profile to filter against:
  //
  // 1. All of the profile's geocoded
  // [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses] where
  // [Address.usage][google.cloud.talent.v4beta1.Address.usage] is PERSONAL and
  // [Address.current][google.cloud.talent.v4beta1.Address.current] is true.
  //
  // 2. If the above set of locations is empty, all of the profile's geocoded
  // [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses] where
  // [Address.usage][google.cloud.talent.v4beta1.Address.usage] is
  // CONTACT_INFO_USAGE_UNSPECIFIED and
  // [Address.current][google.cloud.talent.v4beta1.Address.current] is true.
  //
  // 3. If the above set of locations is empty, all of the profile's geocoded
  // [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses] where
  // [Address.usage][google.cloud.talent.v4beta1.Address.usage] is PERSONAL or
  // CONTACT_INFO_USAGE_UNSPECIFIED and
  // [Address.current][google.cloud.talent.v4beta1.Address.current] is not set.
  //
  // This means that any profiles without any
  // [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses] that
  // match any of the above criteria will not be included in a search with
  // location filter. Furthermore, any
  // [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses] where
  // [Address.usage][google.cloud.talent.v4beta1.Address.usage] is WORK or
  // SCHOOL or where
  // [Address.current][google.cloud.talent.v4beta1.Address.current] is false are
  // not considered for location filter.
  //
  // If a location filter isn't specified, profiles fitting the other search
  // criteria are retrieved regardless of where they're located.
  //
  // If
  // [LocationFilter.negated][google.cloud.talent.v4beta1.LocationFilter.negated]
  // is specified, the result doesn't contain profiles from that location.
  //
  // If
  // [LocationFilter.address][google.cloud.talent.v4beta1.LocationFilter.address]
  // is provided, the
  // [LocationType][google.cloud.talent.v4beta1.Location.LocationType], center
  // point (latitude and longitude), and radius are automatically detected by
  // the Google Maps Geocoding API and included as well. If
  // [LocationFilter.address][google.cloud.talent.v4beta1.LocationFilter.address]
  // cannot be geocoded, the filter falls back to keyword search.
  //
  // If the detected
  // [LocationType][google.cloud.talent.v4beta1.Location.LocationType] is
  // [LocationType.SUB_ADMINISTRATIVE_AREA][google.cloud.talent.v4beta1.Location.LocationType.SUB_ADMINISTRATIVE_AREA],
  // [LocationType.ADMINISTRATIVE_AREA][google.cloud.talent.v4beta1.Location.LocationType.ADMINISTRATIVE_AREA],
  // or
  // [LocationType.COUNTRY][google.cloud.talent.v4beta1.Location.LocationType.COUNTRY],
  // the filter is performed against the detected location name (using exact
  // text matching). Otherwise, the filter is performed against the detected
  // center point and a radius of detected location radius +
  // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles].
  //
  // If
  // [LocationFilter.address][google.cloud.talent.v4beta1.LocationFilter.address]
  // is provided,
  // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles]
  // is the additional radius on top of the radius of the location geocoded from
  // [LocationFilter.address][google.cloud.talent.v4beta1.LocationFilter.address].
  // If
  // [LocationFilter.lat_lng][google.cloud.talent.v4beta1.LocationFilter.lat_lng]
  // is provided,
  // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles]
  // is the only radius that is used.
  //
  // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles]
  // is 10 by default. Note that the value of
  // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles]
  // is 0 if it is unset, so the server does not differentiate
  // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles]
  // that is explicitly set to 0 and
  // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles]
  // that is not set. Which means that if
  // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles]
  // is explicitly set to 0, the server will use the default value of
  // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles]
  // which is 10. To work around this and effectively set
  // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles]
  // to 0, we recommend setting
  // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles]
  // to a very small decimal number (such as 0.00001).
  //
  // If
  // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles]
  // is negative, an error is thrown.
  repeated LocationFilter location_filters = 2;

  // Job title filter specifies job titles of profiles to match on.
  //
  // If a job title isn't specified, profiles with any titles are retrieved.
  //
  // If multiple values are specified, profiles are retrieved with any of the
  // specified job titles.
  //
  // If
  // [JobTitleFilter.negated][google.cloud.talent.v4beta1.JobTitleFilter.negated]
  // is specified, the result won't contain profiles with the job titles.
  //
  // For example, search for profiles with a job title "Product Manager".
  repeated JobTitleFilter job_title_filters = 3;

  // Employer filter specifies employers of profiles to match on.
  //
  // If an employer filter isn't specified, profiles with any employers are
  // retrieved.
  //
  // If multiple employer filters are specified, profiles with any matching
  // employers are retrieved.
  //
  // If
  // [EmployerFilter.negated][google.cloud.talent.v4beta1.EmployerFilter.negated]
  // is specified, the result won't contain profiles that match the employers.
  //
  // For example, search for profiles that have working experience at "Google
  // LLC".
  repeated EmployerFilter employer_filters = 4;

  // Education filter specifies education of profiles to match on.
  //
  // If an education filter isn't specified, profiles with any education are
  // retrieved.
  //
  // If multiple education filters are specified, profiles that match any
  // education filters are retrieved.
  //
  // If
  // [EducationFilter.negated][google.cloud.talent.v4beta1.EducationFilter.negated]
  // is specified, the result won't contain profiles that match the educations.
  //
  // For example, search for profiles with a master degree.
  repeated EducationFilter education_filters = 5;

  // Skill filter specifies skill of profiles to match on.
  //
  // If a skill filter isn't specified, profiles with any skills are retrieved.
  //
  // If multiple skill filters are specified, profiles that match any skill
  // filters are retrieved.
  //
  // If [SkillFilter.negated][google.cloud.talent.v4beta1.SkillFilter.negated]
  // is specified, the result won't contain profiles that match the skills.
  //
  // For example, search for profiles that have "Java" and "Python" in skill
  // list.
  repeated SkillFilter skill_filters = 6;

  // Work experience filter specifies the total working experience of profiles
  // to match on.
  //
  // If a work experience filter isn't specified, profiles with any
  // professional experience are retrieved.
  //
  // If multiple work experience filters are specified, profiles that match any
  // work experience filters are retrieved.
  //
  // For example, search for profiles with 10 years of work experience.
  repeated WorkExperienceFilter work_experience_filter = 7;

  // Time filter specifies the create/update timestamp of the profiles to match
  // on.
  //
  // For example, search for profiles created since "2018-1-1".
  repeated TimeFilter time_filters = 8;

  // The hirable filter specifies the profile's hirable status to match on.
  google.protobuf.BoolValue hirable_filter = 9;

  // The application date filters specify application date ranges to match on.
  repeated ApplicationDateFilter application_date_filters = 10;

  // The application outcome notes filters specify the notes for the outcome of
  // the job application.
  repeated ApplicationOutcomeNotesFilter application_outcome_notes_filters = 11;

  // The application job filters specify the job applied for in the application.
  repeated ApplicationJobFilter application_job_filters = 13;

  // This filter specifies a structured syntax to match against the
  // [Profile.custom_attributes][google.cloud.talent.v4beta1.Profile.custom_attributes]
  // that are marked as `filterable`.
  //
  // The syntax for this expression is a subset of Google SQL syntax.
  //
  // String custom attributes: supported operators are =, != where the left of
  // the operator is a custom field key and the right of the operator is a
  // string (surrounded by quotes) value.
  //
  // Numeric custom attributes: Supported operators are '>', '<' or '='
  // operators where the left of the operator is a custom field key and the
  // right of the operator is a numeric value.
  //
  // Supported functions are LOWER(<field_name>) to
  // perform case insensitive match and EMPTY(<field_name>) to filter on the
  // existence of a key.
  //
  // Boolean expressions (AND/OR/NOT) are supported up to 3 levels of
  // nesting (for example "((A AND B AND C) OR NOT D) AND E"), and there can be
  // a maximum of 50 comparisons/functions in the expression. The expression
  // must be < 2000 characters in length.
  //
  // Sample Query:
  // (key1 = "TEST" OR LOWER(key1)="test" OR NOT EMPTY(key1))
  string custom_attribute_filter = 15;

  // Deprecated. Use availability_filters instead.
  //
  // The candidate availability filter which filters based on availability
  // signals.
  //
  // Signal 1: Number of days since most recent job application.  See
  // [Availability.JobApplicationAvailabilitySignal][google.cloud.talent.v4beta1.Availability.JobApplicationAvailabilitySignal]
  // for the details of this signal.
  //
  // Signal 2: Number of days since last profile update. See
  // [Availability.ProfileUpdateAvailabilitySignal][google.cloud.talent.v4beta1.Availability.ProfileUpdateAvailabilitySignal]
  // for the details of this signal.
  //
  // The candidate availability filter helps a recruiter understand if a
  // specific candidate is likely to be actively seeking new job opportunities
  // based on an aggregated set of signals.  Specifically, the intent is NOT to
  // indicate the candidate's potential qualification / interest / close ability
  // for a specific job.
  CandidateAvailabilityFilter candidate_availability_filter = 16
      [deprecated = true];

  // The availability filter which filters based on
  // [Profile.availability_signals][google.cloud.talent.v4beta1.Profile.availability_signals].
  //
  // The availability filter helps a recruiter understand if a
  // specific candidate is likely to be actively seeking new job opportunities
  // based on an aggregated set of signals.  Specifically, the intent is NOT to
  // indicate the candidate's potential qualification / interest / close ability
  // for a specific job.
  //
  // There can be at most one
  // [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter] per
  // [signal_type][google.cloud.talent.v4beta1.AvailabilityFilter.signal_type].
  // If there are multiple
  // [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter] for a
  // [signal_type][google.cloud.talent.v4beta1.AvailabilityFilter.signal_type],
  // an error is thrown.
  repeated AvailabilityFilter availability_filters = 18;

  // Person name filter specifies person name of profiles to match on.
  //
  // If multiple person name filters are specified, profiles that match any
  // person name filters are retrieved.
  //
  // For example, search for profiles of candidates with name "John Smith".
  repeated PersonNameFilter person_name_filters = 17;
}

// Geographic region of the search.
message LocationFilter {
  // Specify whether to include telecommute jobs.
  enum TelecommutePreference {
    // Default value if the telecommute preference isn't specified.
    TELECOMMUTE_PREFERENCE_UNSPECIFIED = 0;

    // Exclude telecommute jobs.
    TELECOMMUTE_EXCLUDED = 1;

    // Allow telecommute jobs.
    TELECOMMUTE_ALLOWED = 2;
  }

  // The address name, such as "Mountain View" or "Bay Area".
  string address = 1;

  // CLDR region code of the country/region of the address. This is used
  // to address ambiguity of the user-input location, for example, "Liverpool"
  // against "Liverpool, NY, US" or "Liverpool, UK".
  //
  // Set this field to bias location resolution toward a specific country
  // or territory. If this field is not set, application behavior is biased
  // toward the United States by default.
  //
  // See https://cldr.unicode.org/ and
  // https://www.unicode.org/cldr/charts/30/supplemental/territory_information.html
  // for details. Example: "CH" for Switzerland.
  // Note that this filter is not applicable for Profile Search related queries.
  string region_code = 2;

  // The latitude and longitude of the geographic center to search from. This
  // field is ignored if `address` is provided.
  google.type.LatLng lat_lng = 3;

  // The distance_in_miles is applied when the location being searched for is
  // identified as a city or smaller. This field is ignored if the location
  // being searched for is a state or larger.
  double distance_in_miles = 4;

  // Allows the client to return jobs without a
  // set location, specifically, telecommuting jobs (telecommuting is considered
  // by the service as a special location.
  // [Job.posting_region][google.cloud.talent.v4beta1.Job.posting_region]
  // indicates if a job permits telecommuting. If this field is set to
  // [TelecommutePreference.TELECOMMUTE_ALLOWED][google.cloud.talent.v4beta1.LocationFilter.TelecommutePreference.TELECOMMUTE_ALLOWED],
  // telecommuting jobs are searched, and
  // [address][google.cloud.talent.v4beta1.LocationFilter.address] and
  // [lat_lng][google.cloud.talent.v4beta1.LocationFilter.lat_lng] are ignored.
  // If not set or set to
  // [TelecommutePreference.TELECOMMUTE_EXCLUDED][google.cloud.talent.v4beta1.LocationFilter.TelecommutePreference.TELECOMMUTE_EXCLUDED],
  // telecommute job are not searched.
  //
  // This filter can be used by itself to search exclusively for telecommuting
  // jobs, or it can be combined with another location
  // filter to search for a combination of job locations,
  // such as "Mountain View" or "telecommuting" jobs. However, when used in
  // combination with other location filters, telecommuting jobs can be
  // treated as less relevant than other jobs in the search response.
  //
  // This field is only used for job search requests.
  TelecommutePreference telecommute_preference = 5;

  // Whether to apply negation to the filter so profiles matching the filter
  // are excluded.
  //
  // Currently only supported in profile search.
  bool negated = 6;
}

// Filter on job compensation type and amount.
message CompensationFilter {
  // Specify the type of filtering.
  enum FilterType {
    // Filter type unspecified. Position holder, INVALID, should never be used.
    FILTER_TYPE_UNSPECIFIED = 0;

    // Filter by `base compensation entry's` unit. A job is a match if and
    // only if the job contains a base CompensationEntry and the base
    // CompensationEntry's unit matches provided
    // [units][google.cloud.talent.v4beta1.CompensationFilter.units]. Populate
    // one or more
    // [units][google.cloud.talent.v4beta1.CompensationFilter.units].
    //
    // See
    // [CompensationInfo.CompensationEntry][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry]
    // for definition of base compensation entry.
    UNIT_ONLY = 1;

    // Filter by `base compensation entry's` unit and amount / range. A job
    // is a match if and only if the job contains a base CompensationEntry, and
    // the base entry's unit matches provided
    // [CompensationUnit][google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit]
    // and amount or range overlaps with provided
    // [CompensationRange][google.cloud.talent.v4beta1.CompensationInfo.CompensationRange].
    //
    // See
    // [CompensationInfo.CompensationEntry][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry]
    // for definition of base compensation entry.
    //
    // Set exactly one
    // [units][google.cloud.talent.v4beta1.CompensationFilter.units] and
    // populate [range][google.cloud.talent.v4beta1.CompensationFilter.range].
    UNIT_AND_AMOUNT = 2;

    // Filter by annualized base compensation amount and `base compensation
    // entry's` unit. Populate
    // [range][google.cloud.talent.v4beta1.CompensationFilter.range] and zero or
    // more [units][google.cloud.talent.v4beta1.CompensationFilter.units].
    ANNUALIZED_BASE_AMOUNT = 3;

    // Filter by annualized total compensation amount and `base compensation
    // entry's` unit . Populate
    // [range][google.cloud.talent.v4beta1.CompensationFilter.range] and zero or
    // more [units][google.cloud.talent.v4beta1.CompensationFilter.units].
    ANNUALIZED_TOTAL_AMOUNT = 4;
  }

  // Required. Type of filter.
  FilterType type = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. Specify desired `base compensation entry's`
  // [CompensationInfo.CompensationUnit][google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit].
  repeated CompensationInfo.CompensationUnit units = 2
      [(google.api.field_behavior) = REQUIRED];

  // Compensation range.
  CompensationInfo.CompensationRange range = 3;

  // If set to true, jobs with unspecified compensation range fields are
  // included.
  bool include_jobs_with_unspecified_compensation_range = 4;
}

// Parameters needed for commute search.
message CommuteFilter {
  // The traffic density to use when calculating commute time.
  enum RoadTraffic {
    // Road traffic situation isn't specified.
    ROAD_TRAFFIC_UNSPECIFIED = 0;

    // Optimal commute time without considering any traffic impact.
    TRAFFIC_FREE = 1;

    // Commute time calculation takes in account the peak traffic impact.
    BUSY_HOUR = 2;
  }

  // Required. The method of transportation to calculate the commute time for.
  CommuteMethod commute_method = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. The latitude and longitude of the location to calculate the
  // commute time from.
  google.type.LatLng start_coordinates = 2
      [(google.api.field_behavior) = REQUIRED];

  // Required. The maximum travel time in seconds. The maximum allowed value is
  // `3600s` (one hour). Format is `123s`.
  google.protobuf.Duration travel_duration = 3
      [(google.api.field_behavior) = REQUIRED];

  // If `true`, jobs without street level addresses may also be returned.
  // For city level addresses, the city center is used. For state and coarser
  // level addresses, text matching is used.
  // If this field is set to `false` or isn't specified, only jobs that include
  // street level addresses will be returned by commute search.
  bool allow_imprecise_addresses = 4;

  // Traffic factor to take into account while searching by commute.
  oneof traffic_option {
    // Specifies the traffic density to use when calculating commute time.
    RoadTraffic road_traffic = 5;

    // The departure time used to calculate traffic impact, represented as
    // [google.type.TimeOfDay][google.type.TimeOfDay] in local time zone.
    //
    // Currently traffic model is restricted to hour level resolution.
    google.type.TimeOfDay departure_time = 6;
  }
}

// Job title of the search.
message JobTitleFilter {
  // Required. The job title. For example, "Software engineer", or "Product
  // manager".
  string job_title = 1 [(google.api.field_behavior) = REQUIRED];

  // Whether to apply negation to the filter so profiles matching the filter
  // are excluded.
  bool negated = 2;
}

// Skill filter of the search.
message SkillFilter {
  // Required. The skill name. For example, "java", "j2ee", and so on.
  string skill = 1 [(google.api.field_behavior) = REQUIRED];

  // Whether to apply negation to the filter so profiles matching the filter
  // are excluded.
  bool negated = 2;
}

// Employer filter of the search.
message EmployerFilter {
  // Enum indicating which set of
  // [Profile.employment_records][google.cloud.talent.v4beta1.Profile.employment_records]
  // to search against.
  enum EmployerFilterMode {
    // Default value.
    EMPLOYER_FILTER_MODE_UNSPECIFIED = 0;

    // Apply to all employers in
    // [Profile.employment_records][google.cloud.talent.v4beta1.Profile.employment_records].
    ALL_EMPLOYMENT_RECORDS = 1;

    // Apply only to current employer in
    // [Profile.employment_records][google.cloud.talent.v4beta1.Profile.employment_records].
    CURRENT_EMPLOYMENT_RECORDS_ONLY = 2;

    // Apply only to past (not current) employers in
    // [Profile.employment_records][google.cloud.talent.v4beta1.Profile.employment_records].
    PAST_EMPLOYMENT_RECORDS_ONLY = 3;
  }

  // Required. The name of the employer, for example "Google", "Alphabet".
  string employer = 1 [(google.api.field_behavior) = REQUIRED];

  // Define set of
  // [EmploymentRecord][google.cloud.talent.v4beta1.EmploymentRecord]s to search
  // against.
  //
  // Defaults to
  // [EmployerFilterMode.ALL_EMPLOYMENT_RECORDS][google.cloud.talent.v4beta1.EmployerFilter.EmployerFilterMode.ALL_EMPLOYMENT_RECORDS].
  EmployerFilterMode mode = 2;

  // Whether to apply negation to the filter so profiles matching the filter
  // is excluded.
  bool negated = 3;
}

// Education filter of the search.
message EducationFilter {
  // The school name. For example "MIT", "University of California, Berkeley".
  string school = 1;

  // The field of study. This is to search against value provided in
  // [Degree.fields_of_study][google.cloud.talent.v4beta1.Degree.fields_of_study].
  // For example "Computer Science", "Mathematics".
  string field_of_study = 2;

  // Education degree in ISCED code. Each value in degree covers a specific
  // level of education, without any expansion to upper nor lower levels of
  // education degree.
  DegreeType degree_type = 3;

  // Whether to apply negation to the filter so profiles matching the filter
  // is excluded.
  bool negated = 6;
}

// Work experience filter.
//
// This filter is used to search for profiles with working experience length
// between
// [min_experience][google.cloud.talent.v4beta1.WorkExperienceFilter.min_experience]
// and
// [max_experience][google.cloud.talent.v4beta1.WorkExperienceFilter.max_experience].
message WorkExperienceFilter {
  // The minimum duration of the work experience (inclusive).
  google.protobuf.Duration min_experience = 1;

  // The maximum duration of the work experience (exclusive).
  google.protobuf.Duration max_experience = 2;
}

// Application Date Range Filter.
//
// The API matches profiles with
// [Application.application_date][google.cloud.talent.v4beta1.Application.application_date]
// between start date and end date (both boundaries are inclusive). The filter
// is ignored if both
// [start_date][google.cloud.talent.v4beta1.ApplicationDateFilter.start_date]
// and [end_date][google.cloud.talent.v4beta1.ApplicationDateFilter.end_date]
// are missing.
message ApplicationDateFilter {
  // Start date. If it's missing, The API matches profiles with application date
  // not after the end date.
  google.type.Date start_date = 1;

  // End date. If it's missing, The API matches profiles with application date
  // not before the start date.
  google.type.Date end_date = 2;
}

// Outcome Notes Filter.
message ApplicationOutcomeNotesFilter {
  // Required. User entered or selected outcome reason. The API does an exact
  // match on the
  // [Application.outcome_notes][google.cloud.talent.v4beta1.Application.outcome_notes]
  // in profiles.
  string outcome_notes = 1 [(google.api.field_behavior) = REQUIRED];

  // If true, The API excludes all candidates with any
  // [Application.outcome_notes][google.cloud.talent.v4beta1.Application.outcome_notes]
  // matching the outcome reason specified in the filter.
  bool negated = 2;
}

// Filter on the job information of Application.
message ApplicationJobFilter {
  // The job requisition id in the application. The API does an exact match on
  // the [Job.requisition_id][google.cloud.talent.v4beta1.Job.requisition_id] of
  // [Application.job][google.cloud.talent.v4beta1.Application.job] in profiles.
  string job_requisition_id = 2;

  // The job title in the application. The API does an exact match on the
  // [Job.title][google.cloud.talent.v4beta1.Job.title] of
  // [Application.job][google.cloud.talent.v4beta1.Application.job] in profiles.
  string job_title = 3;

  // If true, the API excludes all profiles with any
  // [Application.job][google.cloud.talent.v4beta1.Application.job] matching the
  // filters.
  bool negated = 4;
}

// Filter on create timestamp or update timestamp of profiles.
message TimeFilter {
  // Time fields can be used in TimeFilter.
  enum TimeField {
    // Default value.
    TIME_FIELD_UNSPECIFIED = 0;

    // Earliest profile create time.
    CREATE_TIME = 1;

    // Latest profile update time.
    UPDATE_TIME = 2;
  }

  // Start timestamp, matching profiles with the start time. If this field
  // missing, The API matches profiles with create / update timestamp before the
  // end timestamp.
  google.protobuf.Timestamp start_time = 1;

  // End timestamp, matching profiles with the end time. If this field
  // missing, The API matches profiles with create / update timestamp after the
  // start timestamp.
  google.protobuf.Timestamp end_time = 2;

  // Specifies which time field to filter profiles.
  //
  // Defaults to
  // [TimeField.CREATE_TIME][google.cloud.talent.v4beta1.TimeFilter.TimeField.CREATE_TIME].
  TimeField time_field = 3;
}

// Deprecated. Use AvailabilityFilter instead.
//
// Filter on availability signals.
message CandidateAvailabilityFilter {
  option deprecated = true;

  // It is false by default. If true, API excludes all the potential available
  // profiles.
  bool negated = 1;
}

// Filter on availability signals.
message AvailabilityFilter {
  // Required. Type of signal to apply filter on.
  AvailabilitySignalType signal_type = 1
      [(google.api.field_behavior) = REQUIRED];

  // Required. Range of times to filter candidate signals by.
  TimestampRange range = 2 [(google.api.field_behavior) = REQUIRED];

  // If multiple
  // [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter] are
  // provided, the default behavior is to OR all filters, but if this field is
  // set to true, this particular
  // [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter] will
  // be AND'ed against other
  // [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter].
  bool required = 3;
}

// Filter on person name.
message PersonNameFilter {
  // Required. The person name. For example, "John Smith".
  //
  // Can be any combination of [PersonName.structured_name.given_name][],
  // [PersonName.structured_name.middle_initial][],
  // [PersonName.structured_name.family_name][], and
  // [PersonName.formatted_name][google.cloud.talent.v4beta1.PersonName.formatted_name].
  string person_name = 1 [(google.api.field_behavior) = REQUIRED];
}
