syntax = "proto3";

package com.wixpress.appservice.api.upstream.com.wix.ecom.shipping.label.carrier_spi.v1;

import "google/api/annotations.proto";
import "wix/api/validations.proto";
import "wix/api/annotations.proto";
import "wix/api/api_errors.proto";
import "wix/spi/definitions.proto";
import "wix/api/entity.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";

message PackageDimension {
    option (.wix.api.decomposite_of) = "com.wix.ecom.shipping.label.carrier_spi.v1.PackageDimension";
    // width of the package
    double width = 1 [(.wix.api.min) = 0,(.wix.api.max) = 120];
    // length of the package
    double length = 2 [(.wix.api.min) = 0,(.wix.api.max) = 120];
    // height of the package (Optional)
    google.protobuf.DoubleValue height = 3 [(.wix.api.min) = 0,(.wix.api.max) = 120];
}

message ShippingLabelCarrierSpiConfig {
    option (.wix.api.decomposite_of) = "com.wix.ecom.shipping.label.carrier_spi.v1.ShippingLabelCarrierSpiConfig";
    // the base URI where all the methods are deployed
    string base_uri = 1 [(.wix.spi.base_uri) = true];
    // the countries supported to send from
    repeated string origin_countries  = 2 [(.wix.api.format) = COUNTRY, (.wix.api.minSize) = 1, (.wix.api.maxSize) = 300];
    // the countries supported to send to
    repeated string destination_countries  = 3 [(.wix.api.format) = COUNTRY, (.wix.api.minSize) = 1, (.wix.api.maxSize) = 300];
    // the currency of the labels
    string currency = 4 [(.wix.api.format) = CURRENCY];
    // the measurement system of he labels (Metric or Imperial)
    MeasurementSystem measurement_system = 5;
    // does carrier support insurance
    bool is_insurance_supported = 6;
    // preset carrier packages
    repeated PackageType package_types = 7 [(.wix.api.minSize) = 1, (.wix.api.maxSize) = 20];

    enum MeasurementSystem {
        Metric = 0;
        Imperial = 1;
    }
}

message PackageType {
    option (.wix.api.decomposite_of) = "com.wix.ecom.shipping.label.carrier_spi.v1.PackageType";
    // carrier id that can be used to get quotes and purchase
    string id = 1 [(.wix.api.maxLength) = 30];
    // display name of the package (translated)
    string name = 2 [(.wix.api.maxLength) = 100];
    // description (translated)
    string description = 3 [(.wix.api.maxLength) = 200];
    // the dimensions of the package
    PackageDimension dimension = 4;
    // image of the package (Optional)
    Image image = 5;
}

message Image {
    option (.wix.api.decomposite_of) = "com.wix.ecom.shipping.label.carrier_spi.v1.Image";
    option (.wix.api.decomposition_minimum_fields) = {
        field: "id"
        field: "height"
        field: "width"
    };
    // WixMedia image ID.
    string id = 1;
    // Image URL.
    string url = 2;
    // Original image height.
    int32 height = 3 [(.wix.api.readOnly) = true];
    // Original image width.
    int32 width = 4 [(.wix.api.readOnly) = true];
    // Image alt text. Optional.
    google.protobuf.StringValue alt_text = 5;
    // Image URL expiration date (when relevant). Optional
    google.protobuf.Timestamp url_expiration_date = 6 [(.wix.api.field_exposure) = PRIVATE];
    // Image filename. Optional.
    google.protobuf.StringValue filename = 7;
    // Image size in bytes. Optional.
    google.protobuf.StringValue size_in_bytes = 8 [(.wix.api.field_exposure) = PRIVATE, (.wix.api.format) = DECIMAL_VALUE];
}
