syntax = "proto3";

package drasi.v1;

import "drasi/v1/common.proto";
import "google/protobuf/empty.proto";

// Source service for submitting events to Drasi
service SourceService {
    // Submit a single source change event
    rpc SubmitEvent(SubmitEventRequest) returns (SubmitEventResponse);

    // Stream source change events
    rpc StreamEvents(stream SourceChange) returns (stream StreamEventResponse);

    // Request bootstrap data for a query
    rpc RequestBootstrap(BootstrapRequest) returns (stream BootstrapResponse);

    // Health check
    rpc HealthCheck(google.protobuf.Empty) returns (HealthCheckResponse);
}

// Request for submitting a single event
message SubmitEventRequest {
    SourceChange event = 1;
}

// Response for event submission
message SubmitEventResponse {
    bool success = 1;
    string message = 2;
    string error = 3;
    string event_id = 4; // Optional ID assigned to the event
}

// Response for streaming events
message StreamEventResponse {
    bool success = 1;
    string message = 2;
    string error = 3;
    uint64 events_processed = 4;
}

// Health check response
message HealthCheckResponse {
    enum Status {
        STATUS_UNSPECIFIED = 0;
        STATUS_HEALTHY = 1;
        STATUS_DEGRADED = 2;
        STATUS_UNHEALTHY = 3;
    }

    Status status = 1;
    string message = 2;
    string version = 3;
}
