{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://jasonlotito.github.io/daytiles/schema/v1/memories.schema.json",
  "title": "Daytiles memories export, version 1",
  "description": "The memories.json file inside a Daytiles memories zip. Photos are JPEG files in the same zip, at the paths given here, relative to memories.json. Versioned like the habits export: unknown properties are ignored.",
  "type": "object",
  "required": [
    "format",
    "version",
    "memories"
  ],
  "properties": {
    "$schema": {
      "type": "string"
    },
    "format": {
      "const": "daytiles-memories"
    },
    "version": {
      "const": 1
    },
    "exportedAt": {
      "type": "string",
      "format": "date-time"
    },
    "memories": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/memory"
      }
    },
    "backgrounds": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/background"
      },
      "description": "Photos of your own behind habit pages."
    }
  },
  "$defs": {
    "day": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
      "description": "A calendar day, YYYY-MM-DD, in the person's own time zone. Not a timestamp."
    },
    "memory": {
      "type": "object",
      "required": [
        "habit",
        "day"
      ],
      "properties": {
        "habit": {
          "type": "string",
          "format": "uuid",
          "description": "The habit's id from the habits export. Import the habits first."
        },
        "habitName": {
          "type": "string",
          "description": "For people reading the file. Ignored on import."
        },
        "day": {
          "$ref": "#/$defs/day"
        },
        "note": {
          "type": "string"
        },
        "photo": {
          "type": "string",
          "description": "Path of the photo inside the zip."
        }
      }
    },
    "background": {
      "type": "object",
      "required": [
        "habit",
        "photo"
      ],
      "properties": {
        "habit": {
          "type": "string",
          "format": "uuid"
        },
        "habitName": {
          "type": "string"
        },
        "photo": {
          "type": "string"
        }
      }
    }
  }
}
