{
  "doctype": "DocType",
  "name": "NSDL Sync Run",
  "module": "Import_documents",
  "custom": 0,
  "istable": 0,
  "issingle": 0,
  "is_submittable": 0,
  "track_changes": 1,
  "autoname": "format:NSR-{client_name}-{run_date}-{#####}",
  "sort_field": "modified",
  "sort_order": "DESC",
  "fields": [
    {
      "fieldname": "run_date",
      "label": "Run Date",
      "fieldtype": "Date",
      "reqd": 1,
      "in_list_view": 1,
      "in_standard_filter": 1,
      "description": "Which NSDL export date this sync pulled from (Blueprint SS10)."
    },
    {
      "fieldname": "client_name",
      "label": "Client Name",
      "fieldtype": "Data",
      "reqd": 1,
      "in_list_view": 1,
      "in_standard_filter": 1,
      "description": "Matches the client_name key used in the AWS-side Secrets Manager CLIENTS block and DynamoDB records -- NOT necessarily this site's own display name."
    },
    {
      "fieldname": "status",
      "label": "Status",
      "fieldtype": "Select",
      "options": "Triggered\nDelivered\nNo Pending Records\nFailed",
      "reqd": 1,
      "in_list_view": 1,
      "in_standard_filter": 1
    },
    {
      "fieldname": "records_delivered",
      "label": "Records Delivered",
      "fieldtype": "Int",
      "default": "0",
      "in_list_view": 1
    },
    {
      "fieldname": "pdfs_attached",
      "label": "PDFs Attached",
      "fieldtype": "Int",
      "default": "0",
      "in_list_view": 1
    },
    {
      "fieldname": "error_message",
      "label": "Error Message",
      "fieldtype": "Small Text",
      "depends_on": "eval:doc.status=='Failed'",
      "description": "Set on failure -- fire-and-log-only from the AWS side (Blueprint SS5), never blocks a delivery that already succeeded."
    }
  ],
  "permissions": [
    {
      "role": "System Manager",
      "read": 1,
      "write": 1,
      "create": 1,
      "delete": 1,
      "report": 1,
      "export": 1
    }
  ]
}
