version: 0
id: kyo
type: culture
description: Information for the general Kyōti culture.
baseline: "1832-07-04 / 2390368.5 => 1471/1/1"

# We use this elements as a placeholder for containing the nodes we'll be
# putting into the formats below. This lets us now worry about copy/paste
# errors or keeping everything in sync. Unlike most key/value pairs in YAML,
# these have to be comma-separated because of the copy reference.
_consts:
  - &mtr { constant: " MTR" }
  - &mtrs { constant: " MTR " }
  - &slash { constant: "/" }
  - &colon { constant: ":" }
  - &colon2 { constant: "::" }
  - &space { constant: " " }
  - &mochyu4 {
    ref: mochyu,
    maxDigits: 4,
    minDigits: 4,
    parseJulianOffset: -0.5
  }
  - &koga {
    ref: koga,
    maxDigits: 2,
    minDigits: 1,
    offset: 1,
    parseJulianOffset: 0.25
  }
  - &kogaPeriod {
    ref: koga,
    maxDigits: 2,
    minDigits: 1
  }
  - &mochyuRote {
    ref: mochyuRote,
    maxDigits: 3,
    minDigits: 3,
    offset: 1
  }
  - &mugi {
    ref: mugi,
    maxDigits: 2,
    minDigits: 1,
    offset: 1
  }
  - &mugiPeriod {
    ref: mugi,
    maxDigits: 2,
    minDigits: 1
  }
  - &bidashu {
    ref: bidashu,
    maxDigits: 2,
    minDigits: 1,
    offset: 1
  }
  - &bidashuPeriod {
    ref: bidashu,
    maxDigits: 2,
    minDigits: 1
  }
  - &mochyuRichi {
    ref: mochyuRichi,
    maxDigits: 1,
    minDigits: 1,
    offset: 1
  }
  - &richiRote {
    ref: richiRote,
    maxDigits: 2,
    minDigits: 1,
    offset: 1
  }
  #- &skip25 { default: { koga: 0, mugi: 0, bidashu: 0 } }
  - &skip25 { parseJulianOffset: 0.5 }

# Points in Time
instants:
  refs:
    - mansupi-tachira-ripochya
    - mifuno-kopachi
  formats:
    # Date Formats
    YYYY MTR:
      type: date
      elements: [
        *mochyu4, *mtr
      ]
    YYYY/OOO MTR:
      type: date
      elements: [
        *mochyu4, *slash, *mochyuRote, *mtr
      ]
    YYYY/R MTR:
      type: date
      elements: [
        *mochyu4, *slash, *mochyuRichi, *mtr, *skip25
      ]
    YYYY/R/O MTR:
      type: date
      elements: [
        *mochyu4, *slash, *mochyuRichi, *slash, *richiRote, *mtr, *skip25
      ]
    YYYY:
      type: date
      elements: [
        *mochyu4
      ]
    YYYY/OOO:
      type: date
      elements: [
        *mochyu4, *slash, *mochyuRote
      ]
    YYYY/R:
      type: date
      elements: [
        *mochyu4, *slash, *mochyuRichi, *skip25
      ]
    YYYY/R/O: &shortDate
      type: date
      elements: [
        *mochyu4, *slash, *mochyuRichi, *slash, *richiRote, *skip25
      ]
    YYY:
      type: date
      elements: [ *mochyu4 ]
    R:
      type: date
      elements: [  *mochyuRichi ]
    O:
      type: date
      elements: [ *richiRote ]

    # Date/Time Formats
    YYYY/OOO MTR K:::
      type: dateTime
      elements: [
        *mochyu4, *slash, *mochyuRote, *mtrs,
        *koga, *colon2
      ]
    YYYY/R/O MTR K:::
      type: dateTime
      elements: [
        *mochyu4, *slash, *mochyuRichi, *slash, *richiRote, *mtrs,
        *koga, *colon2
      ]
    YYYY/OOO MTR K::M:
      type: dateTime
      elements: [
        *mochyu4, *slash, *mochyuRote, *mtrs,
        *koga, *colon2, *mugi
      ]
    YYYY/R/O MTR K::M:
      type: dateTime
      elements: [
        *mochyu4, *slash, *mochyuRichi, *slash, *richiRote, *mtrs,
        *koga, *colon2, *mugi
      ]
    YYYY/OOO MTR K::M:B:
      type: dateTime
      elements: [
        *mochyu4, *slash, *mochyuRote, *mtrs,
        *koga, *colon2, *mugi, *colon, *bidashu
      ]
    YYYY/R/O MTR K::M:B:
      type: dateTime
      elements: [
        *mochyu4, *slash, *mochyuRichi, *slash, *richiRote, *mtrs,
        *koga, *colon2, *mugi, *colon, *bidashu
      ]
    YYYY/OOO K:::
      type: dateTime
      elements: [
        *mochyu4, *slash, *mochyuRote, *space,
        *koga, *colon2
      ]
    YYYY/R/O K:::
      type: dateTime
      elements: [
        *mochyu4, *slash, *mochyuRichi, *slash, *richiRote, *space,
        *koga, *colon2
      ]
    YYYY/OOO K::M:
      type: dateTime
      elements: [
        *mochyu4, *slash, *mochyuRote, *space,
        *koga, *colon2, *mugi
      ]
    YYYY/R/O K::M: &shortDateTime
      type: dateTime
      elements: [
        *mochyu4, *slash, *mochyuRichi, *slash, *richiRote, *space,
        *koga, *colon2, *mugi
      ]
    YYYY/OOO K::M:B:
      type: dateTime
      elements: [
        *mochyu4, *slash, *mochyuRote, *space,
        *koga, *colon2, *mugi, *colon, *bidashu
      ]
    YYYY/R/O K::M:B:
      type: dateTime
      elements: [
        *mochyu4, *slash, *mochyuRichi, *slash, *richiRote, *space,
        *koga, *colon2, *mugi, *colon, *bidashu
      ]

    # Time Formats
    K:::
      type: time
      elements: [
        *koga, *colon2
      ]
    K::M: &shortTime
      type: time
      elements: [
        *koga, *colon2, *mugi
      ]
    K::M:B:
      type: time
      elements: [
        *koga, *colon2, *mugi, *colon, *bidashu
      ]
    ::M:B:
      type: time
      elements: [
        *colon2, *mugi, *colon, *bidashu
      ]
    :::B:
      type: time
      elements: [
        *colon2, *colon, *bidashu
      ]
    K:
      type: time
      elements: [
        *koga
      ]
    M:
      type: time
      elements: [
        *mugi
      ]
    B:
      type: time
      elements: [
        *bidashu
      ]

    # Aliases
    shortDate: *shortDate
    shortDateTime: *shortDateTime
    shortTime: *shortTime
    default: *shortDateTime

periods:
  refs:
    - mifuno-kopachi-period
  formats:
    K:::
      elements: [ *kogaPeriod, *colon2 ]
    K::M:
      elements: [ *kogaPeriod, *colon2, *mugiPeriod ]
    K::M:B:
      elements: [ *kogaPeriod, *colon2, *mugiPeriod, *colon, *bidashuPeriod ]
