syntax = "proto3";

package core;
option go_package = "github.com/letsencrypt/boulder/core/proto";

message Challenge {
  int64 id = 1;
  string type = 2;
  string status = 6;
  string uri = 9;
  string token = 3;
  string keyAuthorization = 5;
  repeated ValidationRecord validationrecords = 10;
  ProblemDetails error = 7;
  int64 validated = 11;
}

message ValidationRecord {
  string hostname = 1;
  string port = 2;
  repeated bytes addressesResolved = 3; // net.IP.MarshalText()
  bytes addressUsed = 4; // net.IP.MarshalText()

  repeated string authorities = 5;
  string url = 6;
  // A list of addresses tried before the address used (see
  // core/objects.go and the comment on the ValidationRecord structure
  // definition for more information.
  repeated bytes addressesTried = 7; // net.IP.MarshalText()
}

message ProblemDetails {
  string problemType = 1;
  string detail = 2;
  int32 httpStatus = 3;
}

message Certificate {
  int64 registrationID = 1;
  string serial = 2;
  string digest = 3;
  bytes der = 4;
  int64 issued = 5;  // Unix timestamp (nanoseconds)
  int64 expires = 6; // Unix timestamp (nanoseconds)
}

message CertificateStatus {
  string serial = 1;
  reserved 2; // previously subscriberApproved
  string status = 3;
  int64 ocspLastUpdated = 4;
  int64 revokedDate = 5;
  int64 revokedReason = 6;
  int64 lastExpirationNagSent = 7;
  bytes ocspResponse = 8;
  int64 notAfter = 9;
  bool isExpired = 10;
  int64 issuerID = 11;
}

message Registration {
  int64 id = 1;
  bytes key = 2;
  repeated string contact = 3;
  bool contactsPresent = 4;
  string agreement = 5;
  bytes initialIP = 6;
  int64 createdAt = 7; // Unix timestamp (nanoseconds)
  string status = 8;
}

message Authorization {
  string id = 1;
  string identifier = 2;
  int64 registrationID = 3;
  string status = 4;
  int64 expires = 5; // Unix timestamp (nanoseconds)
  repeated core.Challenge challenges = 6;
  reserved 7; // previously combinations
  reserved 8; // previously v2
}

message Order {
  int64 id = 1;
  int64 registrationID = 2;
  int64 expires = 3;
  ProblemDetails error = 4;
  string certificateSerial = 5;
  reserved 6; // previously authorizations, deprecated in favor of v2Authorizations
  string status = 7;
  repeated string names = 8;
  bool beganProcessing = 9;
  int64 created = 10;
  repeated int64 v2Authorizations = 11;
}

message CRLEntry {
  string serial = 1;
  int32 reason = 2;
  int64 revokedAt = 3; // Unix timestamp (nanoseconds)
}
