syntax = "proto3";
// flynt-disable package-matches-structure
package com.wixpress.appservice.api.upstream.wix.segments.spi.v2.upstream.wix.common.v2;

option java_multiple_files = true;
option java_package = "com.wixpress.appservice.api.upstream.wix.segments.spi.v2.upstream.wix.common.v2";

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

// Default format to use. Sufficiently compliant with majority of standards: w3c, ISO 4217, ISO 20022, ISO 8583:2003.
// For special cases, one may use just a value without currency to represent money. But:
// - money MUST be a decimal string, as described below
// - currency MUST be provided somewhere at the top level of your object
message Money {
    option (.wix.api.decomposite_of) = "wix.segments.spi.v2.upstream.wix.common.v2.Money";
  option (.wix.api.decomposition_minimum_fields) = {
    field: "amount"
    field: "currency_code"
  };
  // Monetary amount in main currency units, formatted as a decimal string with a period as a decimal separator. For example, `3456.99` or `-789`.
  string amount = 1 [(.wix.api.decimalValue) = {maxScale: 8}];
  // Currency code in [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format. For example, `USD`.
  string currency_code = 2 [(.wix.api.format) = CURRENCY];
}
