syntax = "proto3";

package com.wixpress.authorization.abac.query;

import "com/wixpress/authorization/abac/management/Subject.proto";
import "com/wixpress/authorization/abac/management/Conditions.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "com/wixpress/authorization/abac/Context.proto";

message SubjectAssignment {
    // The subject that has the assignments
    com.wixpress.authorization.abac.management.Subject subject = 1;
    // The policies that the subject has assigned
    repeated PolicyAssignment policies = 2;
}

message PolicyAssignment {
    // The id of the policy
    string policy_id = 1;
    // The name of the policy (will be the role name)
    google.protobuf.StringValue policy_name = 2;
    // When was the policy assigned (the date when the assignment was given)
    google.protobuf.Timestamp assigned_at = 3;
    // The unique id of the assignment
    google.protobuf.StringValue assignment_id = 4;
    // The name of the policy (will be the role name)
    google.protobuf.StringValue policy_description = 5;
    // The resource (if any) that the policy is assigned on
    Resource resource = 6;
    // The condition (if exists) on the policy assignment
    com.wixpress.authorization.abac.management.PolicyCondition condition = 7;
    // The subject that the assignment is assigned to
    com.wixpress.authorization.abac.management.Subject subject = 8;
}

enum ConsistencyLevel {
    WEAK = 0;
    STRONG = 1;
}
