chromium/components/sync/protocol/contact_info_specifics.proto

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// If you change or add any fields in this file, update proto_visitors.h and
// potentially proto_enum_conversions.{h, cc}.

syntax = "proto2";

option java_multiple_files = true;
option java_package = "org.chromium.components.sync.protocol";

option optimize_for = LITE_RUNTIME;

package sync_pb;

message ContactInfoSpecifics {
  // Represents the validation status of a stored value.
  enum VerificationStatus {
    // No verification status assigned.
    VERIFICATION_STATUS_UNSPECIFIED = 0;
    // The value token was parsed from a parent token.
    // For example, the first name was derived by splitting a full name into
    // its components.
    PARSED = 1;
    // Value was built from its subcomponents.
    // For example, the full name was built from the first, middle and last
    // name.
    FORMATTED = 2;
    // The value was observed in a form transmission.
    // For example, the user filled a form that contained at NAME_FULL field.
    // The value of NAME_FULL will be stored as OBSERVED.
    OBSERVED = 3;
    // The user used the settings UI to verify and store this token.
    // This is currently only applicable to the full name, since users cannot
    // edit individual components of their name.
    USER_VERIFIED = 4;
    // The token was parsed remotely.
    SERVER_PARSED = 5;
  }

  message Observation {
    // An `autofill::ProfileTokenQuality::ObservationType`. Represented as a
    // uint32 to retain future enum values (since this is proto2).
    // The `ObservationType`'s underlying type is uint8_t, but this is not
    // supported by protos. Since the uint32 Proto type uses variable-length
    // encoding, uint32 has a similar size as a single element byte[].
    optional uint32 type = 1;
    // The `autofill::ProfileTokenQuality::FormSignatureHash` has type uint8_t.
    // Like for `type`, this should have the (non-existing) data type uint8.
    optional uint32 form_hash = 2;
  }

  // Metadata that is attached to every token type.
  message TokenMetadata {
    optional VerificationStatus status = 1;
    repeated Observation observations = 2;
    // Stores a hash of the token value that this metadata is associated with.
    // This is used by Autofill to detect changes of the token value by external
    // integrators.
    optional uint32 value_hash = 3;
  }

  // A token with a string interpretation of the value.
  message StringToken {
    optional string value = 1;
    optional TokenMetadata metadata = 2;
  }

  // A globally unique, immutable UUID represented in lowercase.
  optional string guid = 1;
  reserved 2;
  reserved "source";
  // The number of time this profile has been used.
  optional int64 use_count = 3;

  // The last times this profile was used. use_date.. is the last use date of
  // the profile, use_date2.. the second last use date, etc. If a profile hasn't
  // been used at least that many times, the field is unset.
  optional int64 use_date_unix_epoch_seconds = 4;
  optional int64 use_date2_unix_epoch_seconds = 54;
  optional int64 use_date3_unix_epoch_seconds = 55;

  // The last time the profile was modified.
  optional int64 date_modified_unix_epoch_seconds = 37;

  // The BCP 47 language code used to format the address for display.
  optional string language_code = 38;

  // A label intended to be chosen by the user. This was however never
  // implemented and is currently unused.
  optional string profile_label = 5;

  // Tracks the application that initially created the profile. The integer
  // represents a value in the server-side enum `BillableService`. A value of
  // 70073 represents Chrome (enum value BILLABLE_SERVICE_CHROME_PAYMENTS).
  optional int32 initial_creator_id = 39;
  // Tracks the application that applied the last modification to the
  // non-metadata content of the profile. It represents a value in the same
  // `BillableService` enum.
  // All StringTokens, and the `profile_label` are considered non-metadata.
  optional int32 last_modifier_id = 40;

  // Contact info name fields.
  optional StringToken name_first = 7;
  optional StringToken name_middle = 8;
  optional StringToken name_last = 9;
  // Sometimes the last name is composed of two names as it is common for
  // Hispanic/Latinx names. In the unstructured representation of the last name,
  // there may be even a conjunction between the first and the second last
  // name. For example, the more-complete version of Pablo Picasso's surname is
  // "Ruiz y Picasso" containing a first last name, a conjunction (the y) and a
  // second last name.
  optional StringToken name_last_first = 10;
  optional StringToken name_last_conjunction = 11;
  optional StringToken name_last_second = 12;
  optional StringToken name_full = 13;

  reserved 14;
  reserved "name_full_with_honorific";

  // Contact info additional fields.
  optional StringToken email_address = 15;
  optional StringToken company_name = 16;

  // Address fields: These are user-provided values with no particular
  // guarantees about their format.
  optional StringToken address_city = 17;
  optional StringToken address_state = 18;
  optional StringToken address_zip = 19;
  optional StringToken address_country = 20;
  optional StringToken address_admin_level_2 = 43;

  // Additional address fields for i18n.
  // Includes all of the lines of a street address, including newlines, e.g.
  //   123 Main Street,
  //   Apt. #42
  optional StringToken address_street_address = 21;
  // A sorting code is similar to a postal code. However, whereas a postal code
  // normally refers to a single geographical location, a sorting code often
  // does not. Instead, a sorting code is assigned to an organization, which
  // might be geographically distributed. The most prominent example of a
  // sorting code system is CEDEX in France.
  optional StringToken address_sorting_code = 22;
  // A dependent locality is a subunit of a locality, where a "locality" is
  // roughly equivalent to a city. Examples of dependent localities include
  // inner-city districts and suburbs.
  optional StringToken address_dependent_locality = 23;
  reserved 24;
  reserved "address_language_code";
  // The street name of the address, without a house number.
  optional StringToken address_thoroughfare_name = 25;
  // The house number, which may be alphanumeric.
  optional StringToken address_thoroughfare_number = 26;
  // Deprecated in M118.
  reserved 27;
  reserved "address_dependent_thoroughfare_name";
  reserved 28;
  reserved "address_thoroughfare_and_dependent_thoroughfare_name";
  reserved 29;
  reserved "address_premise_name";
  // Contains the floor, staircase or apartment number within a building.
  optional StringToken address_subpremise_name = 30;
  // All the information related to the apartment. Normally a combination of the
  // apartment type (address_apt_type) and number (address_apt_num).
  // E.g. "Apt 5".
  optional StringToken address_apt = 50;
  // The apartment number within a building.
  optional StringToken address_apt_num = 31;
  // Information describing the type of apartment (e.g. Apt, Apartamento, Sala,
  // Departamento).
  optional StringToken address_apt_type = 51;
  // The floor number within a building.
  optional StringToken address_floor = 32;
  // Contains both the street and house number.
  optional StringToken address_street_location = 44;

  optional StringToken address_landmark = 41;
  optional StringToken address_overflow = 45;
  // Indicates that the address is at the intersection between two streets.
  // It is normally a combination of between_streets_1 and _2. This is a common
  // way of writing addresses in Mexico.
  optional StringToken address_between_streets = 42;
  // The meaning of the field is similar to address_between_streets. The
  // type should be used for "Entre calle 1" in MX addresses which also
  // contain the "Entre calle 2" field.
  optional StringToken address_between_streets_1 = 46;
  // The meaning of the field is similar to address_between_streets. The
  // type should be used for "Entre calle 2" in MX addresses which also
  // contain the "Entre calle 1" field.
  optional StringToken address_between_streets_2 = 47;
  // Combination of types address_between_streets or address_landmark. Note that
  // some address forms require the combination of both in a single field as
  // opposed to each one separately.
  optional StringToken address_between_streets_or_landmark = 48;
  // Combination of types address_overflow and address_landmark. Note that some
  // address forms require the combination of both in a single field as opposed
  // to each one separately.
  optional StringToken address_overflow_and_landmark = 49;
  // Combination of types address_street_location and
  // address_dependent_locality. Note that some address forms require the
  // combination of both in a single field as opposed to each one separately.
  optional StringToken address_street_location_and_locality = 52;
  // Combination of types address_thoroughfare_number and address_apt. Note that
  // some address forms require the combination of both in a single field as
  // opposed to each one separately.
  optional StringToken address_thoroughfare_number_and_apt = 53;

  // Phone.
  optional StringToken phone_home_whole_number = 33;

  // Removed in M123.
  reserved 34;
  reserved "birthdate_day";
  reserved 35;
  reserved "birthdate_month";
  reserved 36;
  reserved "birthdate_year";

  // Removed in M122.
  reserved 6;
  reserved "name_honorific";
}