syntax = "proto3";

package geocoding;
option go_package = "./proto;geocoding";

service Geocoding {
	// Lookup an address, the result will be the normalized address which contains coordinates
	rpc Lookup(LookupRequest) returns (LookupResponse) {};
	// Reverse geocode coordinates to an address
	rpc Reverse(ReverseRequest) returns (ReverseResponse) {};
}

message Address {
	string line_one = 1;
	string line_two = 2;
	string city = 3;
	string country = 4;
	string postcode = 5;
}

message Location {
	double latitude = 1;
	double longitude = 2;
}

// Lookup returns a geocoded address including normalized address and gps coordinates. All fields are optional, provide more to get more accurate results
message LookupRequest {
	string address = 1;
	string city = 2;
	string postcode = 3;
	string country = 4;
}

message LookupResponse {
	Address address = 1;
	Location location = 2;
}

// Reverse lookup an address from gps coordinates
message ReverseRequest {
	double latitude = 1;
	double longitude = 2;
}

message ReverseResponse {
	Address address = 1;
	Location location = 2;
}
