/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 */

syntax = "proto3";

option java_multiple_files = true;
package org.apache.custos.sharing.core;

option go_package = "./pb";

enum SearchCondition {
    EQUAL = 0;
    LIKE = 1;
    GTE = 2;
    LTE = 3;
    NOT = 4;
}

enum EntitySearchField {
    NAME = 0;
    DESCRIPTION = 1;
    ID = 2;
    FULL_TEXT = 3;
    OWNER_ID = 4;
    CREATED_AT = 5;
    LAST_MODIFIED_AT = 6;
    ENTITY_TYPE_ID = 7;
    PARENT_ID = 8;
    SHARED_COUNT = 9;
    PERMISSION_TYPE_ID = 10;
    SHARED_BY=11;
    SHARED_WITH=12;
}


message EntityType {
    string id = 1;
    string name = 2;
    string description = 3;
    int64 created_at = 4;
    int64 updated_at = 5;
}

message PermissionType {
    string id = 1;
    string name = 2;
    string description = 3;
    int64 created_at = 4;
    int64 updated_at = 5;
}

message Entity {
    string id = 1;
    string type = 2;
    string owner_id = 3;
    string parent_id = 4;
    string name = 5;
    string description = 6;
    bytes binary_data = 7;
    string full_text = 8;
    int64 original_creation_time = 9;
    int64 created_at = 10;
    int64 updated_at = 11;
    int32 shared_count = 12;
    SharingMetadata sharing_metadata = 13;
}

message SearchCriteria {
    EntitySearchField search_field = 1;
    string value = 2;
    SearchCondition condition = 3;
}

//message Status {
//    bool status = 1;
//}

//message EntityTypes {
//    repeated EntityType types = 1;
//}
//
//message PermissionTypes {
//    repeated PermissionType types = 1;
//}
//
//message Entities {
//    repeated Entity entity_array = 1;
//}
//
//message SharedOwners {
//    repeated string owner_ids = 1;
//}

message SharingMetadata {
    Entity entity = 1;
    string owner_id = 2;
    string owner_type = 3;
    repeated PermissionType permissions = 4;
    string shared_by = 5;
}