125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng/*
2ef3cfa88ea07fcd49651bf584b92bdc3dce7d83cphilip.liard@gmail.com * Copyright (C) 2009 The Libphonenumber Authors
325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng *
425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng * Licensed under the Apache License, Version 2.0 (the "License");
525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng * you may not use this file except in compliance with the License.
625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng * You may obtain a copy of the License at
725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng *
825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng * http://www.apache.org/licenses/LICENSE-2.0
925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng *
1025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng * Unless required by applicable law or agreed to in writing, software
1125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng * distributed under the License is distributed on an "AS IS" BASIS,
1225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng * See the License for the specific language governing permissions and
1425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng * limitations under the License.
1525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng */
1625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
1725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng// Definition of protocol buffer for holding metadata for international
180822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com// telephone numbers. The fields here correspond exactly to those in
190822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com// resources/PhoneNumberMetaData.xml.
2025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng// @author Shaopeng Jia
2125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
2225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.pengsyntax = "proto2";
2325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
2425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.pengoption java_package = "com.google.i18n.phonenumbers";
2508c71407c0b390fa18509147af2e9c504e8d65ebjia.shao.pengoption optimize_for = LITE_RUNTIME;
2608c71407c0b390fa18509147af2e9c504e8d65ebjia.shao.peng
2725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.pengpackage i18n.phonenumbers;
2825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
2925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.pengmessage NumberFormat {
3025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // pattern is a regex that is used to match the national (significant)
3125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // number. For example, the pattern "(20)(\d{4})(\d{4})" will match number
3225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // "2070313000", which is the national (significant) number for Google London.
3325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // Note the presence of the parentheses, which are capturing groups what
3425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // specifies the grouping of numbers.
3525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  required string pattern = 1;
3625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
3725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // format specifies how the national (significant) number matched by
3825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // pattern should be formatted.
3925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // Using the same example as above, format could contain "$1 $2 $3",
4025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // meaning that the number should be formatted as "20 7031 3000".
4125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // Each $x are replaced by the numbers captured by group x in the
4225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // regex specified by pattern.
4325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  required string format = 2;
4425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
4525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // This field is a regex that is used to match a certain number of digits
4625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // at the beginning of the national (significant) number. When the match is
4725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // successful, the accompanying pattern and format should be used to format
4825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // this number. For example, if leading_digits="[1-3]|44", then all the
4925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // national numbers starting with 1, 2, 3 or 44 should be formatted using the
5025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // accompanying pattern and format.
5125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  //
5225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // The first leadingDigitsPattern matches up to the first three digits of the
5325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // national (significant) number; the next one matches the first four digits,
5425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // then the first five and so on, until the leadingDigitsPattern can uniquely
5525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // identify one pattern and format to be used to format the number.
5625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  //
5725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // In the case when only one formatting pattern exists, no
5825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // leading_digits_pattern is needed.
5925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  repeated string leading_digits_pattern = 3;
6025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
6125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // This field specifies how the national prefix ($NP) together with the first
6225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // group ($FG) in the national significant number should be formatted in
6325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // the NATIONAL format when a national prefix exists for a certain country.
6425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // For example, when this field contains "($NP$FG)", a number from Beijing,
6525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // China (whose $NP = 0), which would by default be formatted without
6625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // national prefix as 10 1234 5678 in NATIONAL format, will instead be
6725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // formatted as (010) 1234 5678; to format it as (0)10 1234 5678, the field
6825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // would contain "($NP)$FG". Note $FG should always be present in this field,
6925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // but $NP can be omitted. For example, having "$FG" could indicate the
7025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // number should be formatted in NATIONAL format without the national prefix.
710822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  // This is commonly used to override the rule specified for the territory in
720822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  // the XML file.
7325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  //
7425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // When this field is missing, a number will be formatted without national
7525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // prefix in NATIONAL format. This field does not affect how a number
7625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // is formatted in other formats, such as INTERNATIONAL.
7725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  optional string national_prefix_formatting_rule = 4;
7825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
790822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  // This field specifies whether the $NP can be omitted when formatting a
800822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  // number in national format, even though it usually wouldn't be. For example,
810822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  // a UK number would be formatted by our library as 020 XXXX XXXX. If we have
820822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  // commonly seen this number written by people without the leading 0, for
830822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  // example as (20) XXXX XXXX, this field would be set to true. This will be
840822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  // inherited from the value set for the territory in the XML file, unless a
850822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  // national_prefix_formatting_rule is defined specifically for this
860822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  // NumberFormat.
870822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  optional bool national_prefix_optional_when_formatting = 6;
880822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com
8925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // This field specifies how any carrier code ($CC) together with the first
9025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // group ($FG) in the national significant number should be formatted
9125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // when formatWithCarrierCode is called, if carrier codes are used for a
9225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // certain country.
9325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  optional string domestic_carrier_code_formatting_rule = 5;
9425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng}
9525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
9625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.pengmessage PhoneNumberDesc {
9725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // The national_number_pattern is the pattern that a valid national
9825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // significant number would match. This specifies information such as its
9925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // total length and leading digits.
10025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  optional string national_number_pattern = 2;
10125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
10225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // The possible_number_pattern represents what a potentially valid phone
10325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // number for this region may be written as. This is a superset of the
10425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // national_number_pattern above and includes numbers that have the area code
10525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // omitted. Typically the only restrictions here are in the number of digits.
10625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // This could be used to highlight tokens in a text that may be a phone
10725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // number, or to quickly prune numbers that could not possibly be a phone
10825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // number for this locale.
10925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  optional string possible_number_pattern = 3;
11025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
11125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // An example national significant number for the specific type. It should
11225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // not contain any formatting information.
11325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  optional string example_number = 6;
11425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng}
11525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
11625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.pengmessage PhoneMetadata {
11725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // The general_desc contains information which is a superset of descriptions
11825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // for all types of phone numbers. If any element is missing in the
11925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // description of a specific type in the XML file, the element will inherit
12025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // from its counterpart in the general_desc. Every locale is assumed to have
12125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // fixed line and mobile numbers - if these types are missing in the XML
12225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // file, they will inherit all fields from the general_desc. For all other
12325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // types, if the whole type is missing in the xml file, it will be given a
12425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // national_number_pattern of "NA" and a possible_number_pattern of "NA".
12525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  required PhoneNumberDesc general_desc = 1;
12625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  required PhoneNumberDesc fixed_line = 2;
12725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  required PhoneNumberDesc mobile = 3;
12825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  required PhoneNumberDesc toll_free = 4;
12925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  required PhoneNumberDesc premium_rate = 5;
13025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  required PhoneNumberDesc shared_cost = 6;
13125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  required PhoneNumberDesc personal_number = 7;
13225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  required PhoneNumberDesc voip = 8;
13325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  required PhoneNumberDesc pager = 21;
13425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  required PhoneNumberDesc uan = 25;
135bf75c1ecfb92546d34ad58d70052661cbccf0598lararennie@google.com  required PhoneNumberDesc emergency = 27;
1366304698665543aadc92efafbced01cb2e63d1780lararennie@google.com  required PhoneNumberDesc voicemail = 28;
13725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // The rules here distinguish the numbers that are only able to be dialled
13825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // nationally.
13925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  required PhoneNumberDesc no_international_dialling = 24;
14025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
14192548ceca818ac71c5063fd4e61c7f41f5fe00fdlararennie@google.com  // The ISO 3166-1 alpha-2 representation of a country/region, with the
14292548ceca818ac71c5063fd4e61c7f41f5fe00fdlararennie@google.com  // exception of "country calling codes" used for non-geographical entities,
14392548ceca818ac71c5063fd4e61c7f41f5fe00fdlararennie@google.com  // such as Universal International Toll Free Number (+800). These are all
14492548ceca818ac71c5063fd4e61c7f41f5fe00fdlararennie@google.com  // given the ID "001", since this is the numeric region code for the world
14592548ceca818ac71c5063fd4e61c7f41f5fe00fdlararennie@google.com  // according to UN M.49: http://en.wikipedia.org/wiki/UN_M.49
14625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  required string id = 9;
14725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
14825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // The country calling code that one would dial from overseas when trying to
14925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // dial a phone number in this country. For example, this would be "64" for
15025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // New Zealand.
15125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  required int32 country_code = 10;
15225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
15325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // The international_prefix of country A is the number that needs to be
15425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // dialled from country A to another country (country B). This is followed
15525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // by the country code for country B. Note that some countries may have more
15625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // than one international prefix, and for those cases, a regular expression
15725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // matching the international prefixes will be stored in this field.
15825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  required string international_prefix = 11;
15925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
16025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // If more than one international prefix is present, a preferred prefix can
16125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // be specified here for out-of-country formatting purposes. If this field is
16225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // not present, and multiple international prefixes are present, then "+"
16325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // will be used instead.
16425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  optional string preferred_international_prefix = 17;
16525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
16625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // The national prefix of country A is the number that needs to be dialled
16725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // before the national significant number when dialling internally. This
16825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // would not be dialled when dialling internationally. For example, in New
16925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // Zealand, the number that would be locally dialled as 09 345 3456 would be
17025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // dialled from overseas as +64 9 345 3456. In this case, 0 is the national
17125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // prefix.
17225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  optional string national_prefix = 12;
17325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
17425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // The preferred prefix when specifying an extension in this country. This is
17525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // used for formatting only, and if this is not specified, a suitable default
17625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // should be used instead. For example, if you wanted extensions to be
17725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // formatted in the following way:
17825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // 1 (365) 345 445 ext. 2345
17925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // " ext. "  should be the preferred extension prefix.
18025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  optional string preferred_extn_prefix = 13;
18125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
18225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // This field is used for cases where the national prefix of a country
18325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // contains a carrier selection code, and is written in the form of a
18425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // regular expression. For example, to dial the number 2222-2222 in
18525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // Fortaleza, Brazil (area code 85) using the long distance carrier Oi
18625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // (selection code 31), one would dial 0 31 85 2222 2222. Assuming the
18725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // only other possible carrier selection code is 32, the field will
18825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // contain "03[12]".
18925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  //
19025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // When it is missing from the XML file, this field inherits the value of
19125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // national_prefix, if that is present.
19225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  optional string national_prefix_for_parsing = 15;
19325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
19425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // This field is only populated and used under very rare situations.
19525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // For example, mobile numbers in Argentina are written in two completely
19625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // different ways when dialed in-country and out-of-country
19725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // (e.g. 0343 15 555 1212 is exactly the same number as +54 9 343 555 1212).
19825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // This field is used together with national_prefix_for_parsing to transform
19925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // the number into a particular representation for storing in the phonenumber
20025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // proto buffer in those rare cases.
20125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  optional string national_prefix_transform_rule = 16;
20225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
20325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // Specifies whether the mobile and fixed-line patterns are the same or not.
20425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // This is used to speed up determining phone number type in countries where
20525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // these two types of phone numbers can never be distinguished.
20625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  optional bool same_mobile_and_fixed_line_pattern = 18 [default=false];
20725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
20825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // Note that the number format here is used for formatting only, not parsing.
20925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // Hence all the varied ways a user *may* write a number need not be recorded
21025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // - just the ideal way we would like to format it for them. When this element
21125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // is absent, the national significant number will be formatted as a whole
21225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // without any formatting applied.
21325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  repeated NumberFormat number_format = 19;
21425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
21525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // This field is populated only when the national significant number is
21625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // formatted differently when it forms part of the INTERNATIONAL format
21725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // and NATIONAL format. A case in point is mobile numbers in Argentina:
21825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // The number, which would be written in INTERNATIONAL format as
21925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // +54 9 343 555 1212, will be written as 0343 15 555 1212 for NATIONAL
22025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // format. In this case, the prefix 9 is inserted when dialling from
22125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // overseas, but otherwise the prefix 0 and the carrier selection code
22225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // 15 (inserted after the area code of 343) is used.
2230822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  // Note: this field is populated by setting a value for <intlFormat> inside
2240822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  // the <numberFormat> tag in the XML file. If <intlFormat> is not set then it
2250822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  // defaults to the same value as the <format> tag.
2260822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  //
2270822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  // Examples:
2280822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  //   To set the <intlFormat> to a different value than the <format>:
2290822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  //     <numberFormat pattern=....>
2300822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  //       <format>$1 $2 $3</format>
2310822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  //       <intlFormat>$1-$2-$3</intlFormat>
2320822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  //     </numberFormat>
2330822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  //
2340822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  //   To have a format only used for national formatting, set <intlFormat> to
2350822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  //   "NA":
2360822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  //     <numberFormat pattern=....>
2370822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  //       <format>$1 $2 $3</format>
2380822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  //       <intlFormat>NA</intlFormat>
2390822218a7a5458fc8678b3910ea8a5d575b3ea67lararennie@google.com  //     </numberFormat>
24025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  repeated NumberFormat intl_number_format = 20;
24125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
24225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // This field is set when this country is considered to be the main country
24325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // for a calling code. It may not be set by more than one country with the
24425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // same calling code, and it should not be set by countries with a unique
24525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // calling code. This can be used to indicate that "GB" is the main country
24625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // for the calling code "44" for example, rather than Jersey or the Isle of
24725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // Man.
24825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  optional bool main_country_for_code = 22 [default=false];
24925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
25025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // This field is populated only for countries or regions that share a country
25125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // calling code. If a number matches this pattern, it could belong to this
25225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // region. This is not intended as a replacement for IsValidForRegion, and
25325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // does not mean the number must come from this region (for example, 800
25425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // numbers are valid for all NANPA countries.) This field should be a regular
25525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // expression of the expected prefix match.
25625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  optional string leading_digits = 23;
25725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
25825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // The leading zero in a phone number is meaningful in some countries (e.g.
25925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // Italy). This means they cannot be dropped from the national number when
26025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // converting into international format. If leading zeros are possible for
26125d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // valid international numbers for this region/country then set this to true.
26225d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // This only needs to be set for the region that is the main_country_for_code
26325d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // and all regions associated with that calling code will use the same
26425d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  // setting.
26525d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  optional bool leading_zero_possible = 26 [default=false];
26625d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng}
26725d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng
26825d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.pengmessage PhoneMetadataCollection {
26925d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng  repeated PhoneMetadata metadata = 1;
27025d4969494174d9f0194543d8ebdf12bc0e8065jia.shao.peng}
271