{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/domainee-dev/json-schema/domainee-dev-domain-purchase-schema.json",
  "title": "DomainPurchase",
  "description": "A domain registered through Domainee on the customer's behalf.",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/domainee-dev-openapi.json#/components/schemas/DomainPurchase",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "workspaceId": {
      "type": "string"
    },
    "hostname": {
      "type": "string"
    },
    "years": {
      "type": "integer",
      "minimum": 1,
      "maximum": 10
    },
    "wholesaleCents": {
      "type": "integer",
      "description": "Registrar cost at purchase time."
    },
    "feeCents": {
      "type": "integer",
      "description": "Domainee's per-purchase fee."
    },
    "totalCents": {
      "type": "integer",
      "description": "What the workspace was charged."
    },
    "currency": {
      "type": "string",
      "enum": [
        "USD"
      ]
    },
    "registrar": {
      "type": "string",
      "enum": [
        "namecheap"
      ]
    },
    "registrarDomainId": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "completed",
        "failed",
        "refunded"
      ],
      "description": "`pending` means the charge cleared but the registration is not confirmed yet; a failed registration is refunded automatically."
    },
    "errorMessage": {
      "type": [
        "string",
        "null"
      ]
    },
    "registrant": {
      "type": "object",
      "description": "Minimal owner snapshot. The registrar remains the source of truth.",
      "properties": {
        "firstName": {
          "type": "string"
        },
        "lastName": {
          "type": "string"
        },
        "email": {
          "type": "string",
          "format": "email"
        },
        "country": {
          "type": "string",
          "description": "ISO 3166-1 alpha-2."
        }
      }
    },
    "whoisPrivacyEnabled": {
      "type": "boolean"
    },
    "autoRenew": {
      "type": "boolean"
    },
    "expiresAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "connectedDomainId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Set when the purchase was auto-connected to a /v1/domains entry."
    },
    "customerReference": {
      "type": [
        "string",
        "null"
      ],
      "description": "Opaque caller-supplied reference, echoed on reads and webhooks."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "workspaceId",
    "hostname",
    "years",
    "status",
    "createdAt"
  ]
}