// Copyright (c) 2020 Temporal Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

syntax = "proto3";

package temporal.server.api.persistence.v1;
option go_package = "go.temporal.io/server/api/persistence/v1;persistence";

import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";

import "dependencies/gogoproto/gogo.proto";

import "temporal/api/enums/v1/namespace.proto";
import "temporal/api/namespace/v1/message.proto";

// detail column
message NamespaceDetail {
    NamespaceInfo info = 1;
    NamespaceConfig config = 2;
    NamespaceReplicationConfig replication_config = 3;
    int64 config_version = 4;
    int64 failover_notification_version = 5;
    int64 failover_version = 6;
    google.protobuf.Timestamp failover_end_time = 7 [(gogoproto.stdtime) = true];
}

message NamespaceInfo {
    string id = 1;
    temporal.api.enums.v1.NamespaceState state = 2;
    string name = 3;
    string description = 4;
    string owner = 5;
    map<string, string> data = 6;
}

message NamespaceConfig {
    google.protobuf.Duration retention = 1 [(gogoproto.stdduration) = true];
    string archival_bucket = 2;
    temporal.api.namespace.v1.BadBinaries bad_binaries = 3;
    temporal.api.enums.v1.ArchivalState history_archival_state = 4;
    string history_archival_uri = 5;
    temporal.api.enums.v1.ArchivalState visibility_archival_state = 6;
    string visibility_archival_uri = 7;
}

message NamespaceReplicationConfig {
    string active_cluster_name = 1;
    repeated string clusters = 2;
}
