// 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 User {
  // public_id is used to access the User via an API
  // @inject_tag: gorm:"primary_key"
  string public_id = 10;

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

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

  // description of the user
  // @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 user
  // @inject_tag: `gorm:"default:null"`
  uint32 version = 70;

  // Output only. login_name is a string that maps to the user's account "login
  // name" from the scope's primary auth method
  // @inject_tag: `gorm:"->"`
  string login_name = 90 [json_name = "login_name"];

  // Output only. full_name is a string that maps to the user's account name
  // from the scope's primary auth method
  // @inject_tag: `gorm:"->"`
  string full_name = 100 [json_name = "full_name"];

  // Output only. email is a string that maps to the user's account email from
  // the scope's primary auth method
  // @inject_tag: `gorm:"->"`
  string email = 110 [json_name = "email"];

  // Output only. primary_account_id is a string that maps to the user's account
  // public_id from the scope's primary auth method
  // @inject_tag: `gorm:"->"`
  string primary_account_id = 120 [json_name = "primary_account_id"];
}
