// Copyright IBM Corp. 2020, 2026
// SPDX-License-Identifier: BUSL-1.1

syntax = "proto3";

package controller.storage.iam.store.v1;

import "controller/custom_options/v1/options.proto";
import "controller/storage/timestamp/v1/timestamp.proto";

option go_package = "github.com/hashicorp/boundary/internal/iam/store;store";

message Role {
  // public_id is used to access the Role via an API
  // @inject_tag: gorm:"primary_key"
  string public_id = 1;

  // scope id for the role
  // @inject_tag: `gorm:"default:null"`
  string scope_id = 20;

  // name is the optional friendly name used to
  // access the Role via an API
  // @inject_tag: `gorm:"default:null"`
  string name = 30 [(custom_options.v1.mask_mapping) = {
    this: "name"
    that: "name"
  }];

  // description of the role
  // @inject_tag: `gorm:"default:null"`
  string description = 40 [(custom_options.v1.mask_mapping) = {
    this: "description"
    that: "description"
  }];

  // create_time from the RDBMS
  // @inject_tag: `gorm:"default:current_timestamp"`
  timestamp.v1.Timestamp create_time = 50;

  // update_time from the RDBMS
  // @inject_tag: `gorm:"default:current_timestamp"`
  timestamp.v1.Timestamp update_time = 60;

  // version allows optimistic locking of the role when modifying the role
  // itself and when modifying dependent items like principal roles.
  // @inject_tag: `gorm:"default:null"`
  uint32 version = 70;

  // Previously grant_scope_id
  reserved 80;
}
