// VinylDNSProto.proto
syntax = "proto2";
option java_package = "vinyldns.proto";
option optimize_for = SPEED;

enum Algorithm {
  HMAC_MD5 = 0;
  HMAC_SHA1 = 1;
  HMAC_SHA224 = 2;
  HMAC_SHA256 = 3;
  HMAC_SHA384 = 4;
  HMAC_SHA512 = 5;
}

message ZoneConnection {
  required string name = 1;
  required string keyName = 2;
  required string key = 3;
  required string primaryServer = 4;
  optional Algorithm algorithm = 5 [default = HMAC_MD5];
}

message ACLRule {
  required string accessLevel = 1;
  optional string description = 2;
  optional string userId = 3;
  optional string groupId = 4;
  optional string recordMask = 5;
  repeated string recordTypes = 6;
}

message ZoneACL {
  repeated ACLRule rules = 1;
}

message Zone {
  required string id = 1;
  required string name = 2;
  required string email = 3;
  required string status = 4;
  required int64 created = 5;
  optional int64 updated = 6;
  optional ZoneConnection connection = 7;
  required string account = 8;
  optional bool shared = 9 [default = false];
  optional ZoneConnection transferConnection = 10;
  optional ZoneACL acl = 11;
  optional string adminGroupId = 12 [default = "system"];
  optional int64 latestSync = 13;
  optional bool isTest = 14 [default = false];
  optional string backendId = 15;
  optional string recurrenceSchedule = 16;
  optional string scheduleRequestor = 17;
}

message AData {
  required string address = 1;
}

message AAAAData {
  required string address = 1;
}

message CNAMEData {
  required string cname = 1;
}

message DSData {
  required int32 keyTag = 1;
  required int32 algorithm = 2;
  required int32 digestType = 3;
  required bytes digest = 4;
}

message MXData {
  required int32 preference = 1;
  required string exchange = 2;
}

message NSData {
  required string nsdname = 1;
}

message PTRData {
  required string ptrdname = 1;
}

message SOAData {
  required string mname = 1;
  required string rname = 2;
  required int64 serial = 3;
  required int64 refresh = 4;
  required int64 retry = 5;
  required int64 expire = 6;
  required int64 minimum = 7;
}

message SPFData {
  required string text = 1;
}

message SRVData {
  required int32 priority = 1;
  required int32 weight = 2;
  required int32 port = 3;
  required string target = 4;
}

message NAPTRData {
  required int32 order = 1;
  required int32 preference = 2;
  required string flags = 4;
  required string service = 5;
  required string regexp = 6;
  required string replacement = 7;
}

message SSHFPData {
  required int32 algorithm = 1;
  required int32 typ = 2;
  required string fingerPrint = 3;
}

message TXTData {
  required string text = 1;
}

message RecordData {
  required bytes data = 1;
}

message RecordSet {
  required string zoneId = 1;
  required string id = 2;
  required string name = 3;
  required string typ = 4;
  required int64 ttl = 5;
  required string status = 6;
  required int64 created = 7;
  optional int64 updated = 8;
  repeated RecordData record = 9;
  required string account = 10;
  optional string ownerGroupId = 11;
  optional ownerShipTransfer recordSetGroupChange = 12;
  optional string fqdn = 13;
}

message ownerShipTransfer {
 optional string requestedOwnerGroupId = 1;
 optional string ownerShipTransferStatus = 2;
}

message RecordSetChange {
  required string id = 1;
  required Zone zone = 2;
  required RecordSet recordSet = 3;
  required string userId = 4;
  required string typ = 5;
  required string status = 6;
  required int64 created = 7;
  optional string systemMessage = 8;
  optional RecordSet updates = 9;
  repeated string singleBatchChangeIds = 10;
}

message ZoneChange {
  required string id = 1;
  required string userId = 2;
  required string typ = 3;
  required string status = 4;
  required int64 created = 5;
  required Zone zone = 6;
  optional string systemMessage = 7;
}

message Group {
  required string id = 1;
  required string name = 2;
  required string email = 3;
  required int64 created = 4;
  required string status = 5;
  repeated string memberIds = 6;
  repeated string adminUserIds = 7;
  optional string description = 8;
}

message GroupChange {
  required string groupChangeId = 1;
  required string groupId = 2;
  required string changeType = 3;
  required string userId = 4;
  required int64 created = 5;
  required Group newGroup = 6;
  optional Group oldGroup = 7;
}

message SingleAddChange {
  required int64 ttl = 1;
  required RecordData recordData = 2;
}

message SingleDeleteRecordSetChange {
  optional RecordData recordData = 1;
}

message SingleChangeData {
  required bytes data = 1;
}

message SingleChange {
  required string id = 1;
  required string status = 2;
  optional string zoneId = 3;
  optional string recordName = 4;
  required string changeType = 5;
  required string inputName = 6;
  optional string zoneName = 7;
  required string recordType = 8;
  optional string systemMessage = 9;
  optional string recordChangeId = 10;
  optional string recordSetId = 11;
  optional SingleChangeData changeData = 12;
  repeated SingleChangeError validationErrors = 13;
}

message SingleChangeError {
  required string errorType = 1;
  required string message = 2;
}

message User {
  required string userName = 1;
  required string accessKey = 2;
  required string secretKey = 3;
  required int64 created = 4;
  required string id = 5;
  required bool isSuper = 6;
  required string lockStatus = 7;
  optional string firstName = 8;
  optional string lastName = 9;
  optional string email = 10;
  optional bool isSupport = 11 [default = false];
  optional bool isTest = 12 [default = false];
}

message UserChange {
  required User newUser = 1;
  required string madeByUserId = 2;
  required int64 created = 3;
  required string id = 4;
  required string changeType = 5;
  optional User oldUser = 6;
}
