syntax = "proto2";

import "grr_response_proto/flows.proto";
import "grr_response_proto/jobs.proto";
import "grr_response_proto/knowledge_base.proto";
import "grr_response_proto/semantic.proto";
import "grr_response_proto/sysinfo.proto";


message ClientLabel {
  optional string name = 1;
  optional string owner = 2 [(sem_type) = {
      description: "Username of the user who added the label.",
    }];
}

message StringMapEntry {
  optional string key = 1;
  optional string value = 2;
}

// Next field: 17
message Client {
  optional string client_id = 1 [(sem_type) = {
      description: "The client id of this client.",
    }];
  repeated Filesystem filesystems = 2 [(sem_type) = {
      description: "Mounted Filesystems",
    }];
  optional string os_release = 3 [(sem_type) = {
      description: "OS Distribution or release.",
    }];
  optional string os_version = 4 [(sem_type) = {
      description: "The OS version ID e.g. 6.1.7601SP1, 10.9.2, 14.04.",
    }];
  optional string arch = 5 [(sem_type) = {
      description: "Architecture",
    }];
  optional uint64 install_time = 6 [(sem_type) = {
      type: "RDFDatetime",
      description: "When system was installed.",
    }]; // Called install_date in some legacy code.
  optional KnowledgeBase knowledge_base = 7 [(sem_type) = {
      description: "Knowledge Base",
    }];
  repeated StringMapEntry grr_configuration = 8 [(sem_type) = {
      description: "Running configuration for the GRR client.",
    }];
  repeated StringMapEntry library_versions = 9 [(sem_type) = {
      description: "Running library versions for the client.",
    }];
  optional string kernel = 10 [(sem_type) = {
      description: "Kernel version string.",
    }];
  repeated Volume volumes = 11 [(sem_type) = {
      description: "Client disk volumes.",
    }];
  repeated Interface interfaces = 12 [(sem_type) = {
      description: "Network interfaces.",
    }];
  optional HardwareInfo hardware_info = 13 [(sem_type) = {
      description: "Various hardware information.",
    }];
  optional uint64 memory_size = 14 [(sem_type) = {
      type: "ByteSize",
      description: "Amount of memory this client's machine has.",
    }];
  optional CloudInstance cloud_instance = 15 [(sem_type) = {
      description: "Information about cloud machines.",
    }];
  optional StartupInfo startup_info = 16 [(sem_type) = {
      description: "Information about the GRR client.",
    }];
}


message ClientMetadata {
  optional bytes certificate = 1 [(sem_type) = {
      type: "RDFX509Cert",
    }];
  optional bool fleetspeak_enabled = 2;
  optional uint64 ping = 3 [(sem_type) = {
      type: "RDFDatetime",
      description: "The last time the server heard from this client.",
    }];
  optional uint64 clock = 4 [(sem_type) = {
      type: "RDFDatetime",
      description: "The last clock read on the client. "
                   "(Can be used to estimate client clock skew).",
    }];
  optional NetworkAddress ip = 5;
  optional uint64 last_foreman_time = 6 [(sem_type) = {
      type: "RDFDatetime",
      description: "The last time the foreman checked us.",
    }];
  optional uint64 first_seen = 7 [(sem_type) = {
      type: "RDFDatetime",
      description: "First time the client registered with us",
    }];
  optional uint64 last_crash_timestamp = 8 [(sem_type) = {
      type: "RDFDatetime",
      description: "Last time this client reported a crash.",
    }];
  optional uint64 startup_info_timestamp = 9 [(sem_type) = {
      type: "RDFDatetime",
      description: "Timestamp for the latest change of startup information for "
                   "this client.",
    }];
}

// Next field id: 6
message GRRUser {
  optional string username = 4;
  optional Password password = 1;
  optional GUISettings.UIMode ui_mode = 2;
  optional bool canary_mode = 3;

  enum UserType {
    USER_TYPE_NONE = 0;
    USER_TYPE_STANDARD = 1;
    USER_TYPE_ADMIN = 2;
  }
  optional UserType user_type = 5;
}
