syntax = "proto3";
package matters_service;

service MattersService {
  rpc CreateMatter (CreateMatterRequest) returns (MatterResponse);
  rpc GetMatter    (GetMatterRequest)    returns (MatterResponse);
  rpc ListMatters  (ListMattersRequest)  returns (ListMattersResponse);
  rpc UpdateMatter (UpdateMatterRequest) returns (MatterResponse);
  rpc CloseMatter  (CloseMatterRequest)  returns (MatterResponse);
}

message CreateMatterRequest {
  string tenant_id      = 1;
  string client_id      = 2;
  string matter_type    = 3;  // corporate | family
  string lead_attorney  = 4;
  string description    = 5;
}
message GetMatterRequest    { string id = 1; string tenant_id = 2; }
message ListMattersRequest  { string tenant_id = 1; string status = 2; string attorney_id = 3; }
message UpdateMatterRequest { string id = 1; string tenant_id = 2; string status = 3; string notes = 4; }
message CloseMatterRequest  { string id = 1; string tenant_id = 2; string outcome = 3; }

message MatterResponse {
  string id            = 1;
  string matter_number = 2;
  string client_id     = 3;
  string matter_type   = 4;
  string status        = 5;
  string lead_attorney = 6;
  string court         = 7;
  string judge         = 8;
  string case_number   = 9;
  int64  opened_at     = 10;
  int64  closed_at     = 11;
}
message ListMattersResponse { repeated MatterResponse matters = 1; }
