package org.kie.kogito.index.model;

/* @Indexed */
message KogitoMetadata {
    /* @Field(store = Store.YES) @SortableField */
    optional int64 lastUpdate = 1;
    /* @Field(store = Store.YES) */
    repeated org.kie.kogito.index.model.ProcessInstanceMeta processInstances = 2;
    /* @Field(store = Store.YES) */
    repeated org.kie.kogito.index.model.UserTaskInstanceMeta userTasks = 3;
}

/* @Indexed */
message ProcessInstanceMeta {
    /* @Field(store = Store.YES) */
    optional string id = 1;
    /* @Field(store = Store.YES) */
    optional string processId = 2;
    /* @Field(store = Store.YES) */
    repeated string roles = 3;
    /* @Field(store = Store.YES) */
    optional string endpoint = 4;
    /* @Field(store = Store.YES) */
    optional int32 state = 5;
    optional int64 start = 6;
    optional int64 end = 7;
    /* @Field(store = Store.YES) */
    optional string rootProcessInstanceId = 8;
    /* @Field(store = Store.YES) */
    optional string rootProcessId = 9;
    /* @Field(store = Store.YES) */
    optional string parentProcessInstanceId = 10;
    /* @Field(store = Store.YES) */
    optional string processName = 11;
    /* @Field(store = Store.YES) */
    optional int64 lastUpdate = 12;    
    /* @Field(store = Store.YES) */
    optional string businessKey = 13;
}

/* @Indexed */
message ProcessInstance {
    /* @Field(store = Store.YES) */
    optional string id = 1;
    /* @Field(store = Store.YES) @SortableField */
    optional string processId = 2;
    /* @Field(store = Store.YES) */
    repeated string roles = 3;
    optional string variables = 4;
    /* @Field(store = Store.YES) */
    optional string endpoint = 5;
    repeated NodeInstance nodes = 6;
    /* @Field(store = Store.YES) @SortableField */
    optional int32 state = 7;
    /* @SortableField */
    optional int64 start = 8;
    /* @SortableField */
    optional int64 end = 9;
    /* @Field(store = Store.YES) */
    optional string rootProcessInstanceId = 10;
    /* @Field(store = Store.YES) @SortableField */
    optional string rootProcessId = 11;
    /* @Field(store = Store.YES) */
    optional string parentProcessInstanceId = 12;
    /* @Field(store = Store.YES) @SortableField */
    optional string processName = 13;
    /* @Field(store = Store.YES) */
    optional ProcessInstanceError error = 14;
    /* @Field(store = Store.YES) */
    repeated string addons = 15;
    /* @Field(store = Store.YES) @SortableField */
    optional int64 lastUpdate = 16;
    /* @Field(store = Store.YES) @SortableField */
    optional string businessKey = 17;
    repeated Milestone milestones = 18;
}

/* @Indexed */
message ProcessInstanceError {
    /* @Field(store = Store.YES) @SortableField */
    optional string nodeDefinitionId = 1;
    /* @Field(store = Store.YES) @SortableField */
    optional string message = 2;
}

/* @Indexed */
message NodeInstance {
    /* @Field(store = Store.YES) */
    optional string id = 1;
    /* @Field(store = Store.YES) */
    optional string name = 2;
    /* @Field(store = Store.YES) */
    optional string type = 3;
    optional int64 enter = 4;
    optional int64 exit = 5;
    /* @Field(store = Store.YES) */
    optional string definitionId = 6;
    /* @Field(store = Store.YES) */
    optional string nodeId = 7;
}

/* @Indexed */
message Milestone {
    /* @Field(store = Store.YES) */
    optional string id = 1;
    /* @Field(store = Store.YES) */
    optional string name = 2;
    /* @Field(store = Store.YES) */
    optional string status = 3;
}

/* @Indexed */
message UserTaskInstance {
    /* @Field(store = Store.YES) */
    optional string id = 1;
    /* @Field(store = Store.YES) @SortableField */
    optional string description = 2;
    /* @Field(store = Store.YES) @SortableField */
    optional string name = 3;
    /* @Field(store = Store.YES) @SortableField */
    optional string priority = 4;
    /* @Field(store = Store.YES) */
    optional string processInstanceId = 5;
    /* @Field(store = Store.YES) @SortableField */
    optional string processId = 6;
    /* @Field(store = Store.YES) */
    optional string rootProcessInstanceId = 7;
    /* @Field(store = Store.YES) */
    optional string rootProcessId = 8;
    /* @Field(store = Store.YES) @SortableField */
    optional string state = 9;
    /* @Field(store = Store.YES) @SortableField */
    optional string actualOwner = 10;
    /* @Field(store = Store.YES) */
    repeated string adminGroups = 11;
    /* @Field(store = Store.YES) */
    repeated string adminUsers = 12;
    /* @SortableField */
    optional int64 completed = 13;
    /* @SortableField */
    optional int64 started = 14;
    /* @Field(store = Store.YES) */
    repeated string excludedUsers = 15;
    /* @Field(store = Store.YES) */
    repeated string potentialGroups = 16;
    /* @Field(store = Store.YES) */
    repeated string potentialUsers = 17;
    optional string inputs = 18;
    optional string outputs = 19;
    /* @Field(store = Store.YES) @SortableField */
    optional string referenceName = 20;
    /* @Field(store = Store.YES) @SortableField */
    optional int64 lastUpdate = 21;
    /* @Field(store = Store.YES) */
    optional string endpoint = 22;
    /* @Field(store = Store.YES) */
    repeated Comment comments = 23;
    /* @Field(store = Store.YES) */
    repeated Attachment attachments = 24;
}

/* @Indexed */
message UserTaskInstanceMeta {
    /* @Field(store = Store.YES) */
    optional string id = 1;
    /* @Field(store = Store.YES) */
    optional string description = 2;
    /* @Field(store = Store.YES) */
    optional string name = 3;
    /* @Field(store = Store.YES) */
    optional string priority = 4;
    /* @Field(store = Store.YES) */
    optional string processInstanceId = 5;
    /* @Field(store = Store.YES) */
    optional string state = 6;
    /* @Field(store = Store.YES) */
    optional string actualOwner = 7;
    /* @Field(store = Store.YES) */
    repeated string adminGroups = 8;
    /* @Field(store = Store.YES) */
    repeated string adminUsers = 9;
    optional int64 completed = 10;
    optional int64 started = 11;
    /* @Field(store = Store.YES) */
    repeated string excludedUsers = 12;
    /* @Field(store = Store.YES) */
    repeated string potentialGroups = 13;
    /* @Field(store = Store.YES) */
    repeated string potentialUsers = 14;
    /* @Field(store = Store.YES) */
    optional string referenceName = 15;
    /* @Field(store = Store.YES) */
    optional int64 lastUpdate = 16;
    /* @Field(store = Store.YES) */
    repeated Comment comments = 17;
    /* @Field(store = Store.YES) */
    repeated Attachment attachments = 18;
}

/* @Indexed */
message Comment {
    /* @Field(store = Store.YES) */
    optional string id = 1;
    /* @Field(store = Store.YES) */
    optional string content = 2;
    /* @Field(store = Store.YES) */
    optional int64 updatedAt = 3;
    /* @Field(store = Store.YES) */
    optional string updatedBy = 4;
}

/* @Indexed */
message Attachment {
    /* @Field(store = Store.YES) */
    optional string id = 1;
    /* @Field(store = Store.YES) */
    optional string name = 2;
    /* @Field(store = Store.YES) */
    optional string content = 3;
    /* @Field(store = Store.YES) */
    optional int64 updatedAt = 4;
    /* @Field(store = Store.YES) */
    optional string updatedBy = 5;
}

/* @Indexed */
message Job {
    /* @Field(store = Store.YES) */
    optional string id = 1;
    /* @Field(store = Store.YES) @SortableField */
    optional string processId = 2;
    /* @Field(store = Store.YES) */
    optional string processInstanceId = 3;
    /* @Field(store = Store.YES) @SortableField */
    optional string rootProcessId = 4;
    /* @Field(store = Store.YES) */
    optional string rootProcessInstanceId = 5;
    /* @Field(store = Store.YES) @SortableField */
    optional int64 expirationTime = 6;
    /* @Field(store = Store.YES) @SortableField */
    optional int32 priority = 7;
    optional string callbackEndpoint = 8;
    optional int64 repeatInterval = 9;
    optional int32 repeatLimit = 10;
    /* @Field(store = Store.YES) */
    optional string scheduledId = 11;
    /* @SortableField */
    optional int32 retries = 12;
    /* @Field(store = Store.YES) @SortableField */
    optional string status = 13;
    /* @Field(store = Store.YES) @SortableField */
    optional int64 lastUpdate = 14;
    /* @SortableField */
    optional int32 executionCounter = 15;
    optional string endpoint = 16;
    /* @Field(store = Store.YES) */
    optional string nodeInstanceId = 17;
}
