syntax = "proto3";

package cnperp.common;

import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";

// Common response wrapper for all gRPC services
message UnifiedGrpcResponse {
  bool success = 1;
  string message = 2;
  google.protobuf.Timestamp timestamp = 3;
  map<string, string> meta = 4;
  oneof data {
    google.protobuf.Empty empty = 5;
    bytes json_data = 6;  // For complex data structures
  }
}

// Common pagination request
message PaginationRequest {
  int32 skip = 1;
  int32 limit = 2;
}

// Common pagination response
message PaginationMeta {
  int32 total = 1;
  int32 skip = 2;
  int32 limit = 3;
  int32 pages = 4;
}

// Common error details
message ErrorDetails {
  string code = 1;
  string message = 2;
  map<string, string> context = 3;
}

// Currency amount representation
message MoneyAmount {
  string currency = 1;  // ISO currency code (e.g., "BWP", "USD")
  int64 amount_cents = 2;  // Amount in smallest currency unit
  double amount_decimal = 3;  // Decimal representation
}

// Common address structure
message Address {
  string street = 1;
  string city = 2;
  string state = 3;
  string postal_code = 4;
  string country = 5;
}

// Audit information
message AuditInfo {
  string created_by = 1;
  google.protobuf.Timestamp created_at = 2;
  string updated_by = 3;
  google.protobuf.Timestamp updated_at = 4;
}