syntax = "proto3";

package com.wix.ecommerce.platform_common.api;

option java_multiple_files = true;

import "google/protobuf/wrappers.proto";
import "wix/api/annotations.proto";
import "wix/api/validations.proto";
import "wix/common/address.proto";

//A common address format to use if you plan to store addresses in your service

//Physical address
message Address {
    option (.wix.api.decomposite_of) = "wix.common.Address";
    option (.wix.api.decomposition_minimum_fields) = {
        field: "country"
        field: "subdivision"
        field: "city"
        field: "postal_code"
        field: "street_address"
    };
    option (.wix.api.decomposition_minimum_fields) = {
        field: "country"
        field: "subdivision"
        field: "city"
        field: "postal_code"
        field: "address_line"
        field: "address_line_2"
    };
    // Two-letter country code in [ISO-3166 alpha-2](https://www.iso.org/obp/ui/#search/code/) format.
    google.protobuf.StringValue country = 1 [(.wix.api.format) = COUNTRY];
    // Code for a subdivision (such as state, prefecture, or province) in [ISO 3166-2](https://www.iso.org/standard/72483.html) format.
    google.protobuf.StringValue subdivision = 2 [(.wix.api.maxLength) = 50];
    // City name.
    google.protobuf.StringValue city = 3 [(.wix.api.maxLength) = 50];
    // Postal or zip code.
    google.protobuf.StringValue postal_code = 4 [(.wix.api.maxLength) = 50];
    // Street address.
    .wix.common.StreetAddress street_address = 5;
    // Main address line (usually street name and number).
    google.protobuf.StringValue address_line = 6 [(.wix.api.maxLength) = 150, (.wix.api.pii) = true];
    // Free text providing more detailed address info. Usually contains apt, suite, floor.
    google.protobuf.StringValue address_line_2 = 7 [(.wix.api.maxLength) = 100, (.wix.api.pii) = true];
    .wix.common.AddressLocation geocode = 10 [(.wix.api.field_exposure) = PRIVATE];
    // Country's full name.
    //flynt-disable unannotated-pii-fields
    google.protobuf.StringValue country_fullname = 11 [(.wix.api.readOnly) = true, (.wix.api.pii) = true];
    // Subdivision full-name.
    //flynt-disable unannotated-pii-fields
    google.protobuf.StringValue subdivision_fullname = 13 [(.wix.api.readOnly) = true, (.wix.api.pii) = true];
}

//Full contact details for an address
message FullAddressContactDetails {
    option (.wix.api.decomposite_of) = "wix.common.FullAddressContactDetails";
    option (.wix.api.decomposition_minimum_fields) = {
        field: "first_name"
        field: "last_name"
    };
    // First name.
    google.protobuf.StringValue first_name = 1 [(.wix.api.maxLength) = 100, (.wix.api.pii) = true];
    // Last name.
    google.protobuf.StringValue last_name = 2 [(.wix.api.maxLength) = 100, (.wix.api.pii) = true];
    // Phone number.
    google.protobuf.StringValue phone = 3 [(.wix.api.format) = PHONE, (.wix.api.pii) = true];
    // Company name.
    google.protobuf.StringValue company = 4 [(.wix.api.maxLength) = 1000];
    // Tax information (for Brazil only). If ID is provided, `vatId.type` must also be set, `UNSPECIFIED` is not allowed.
    .wix.common.VatId vat_id = 7;
}
