#
# IMPORTANT NOTE
#
# This chart inherits from our common library chart. You can check the default values/options here:
# https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common/values.yaml
#

image:
  # -- image repository
  repository: jakowenko/double-take
  # -- image tag
  tag: 1.6.0
  # -- image pull policy
  pullPolicy: IfNotPresent

# -- Configures service settings for the chart.
# @default -- See values.yaml
service:
  main:
    ports:
      http:
        port: 3000

ingress:
  # -- Enable and configure ingress settings for the chart under this key.
  # @default -- See values.yaml
  main:
    enabled: false

# -- Configure persistence settings for the chart under this key.
# See [API Images](https://github.com/jakowenko/double-take#api-images) for explaination on what data is stored where.
# @default -- See values.yaml
persistence:
  data:
    enabled: false
    mountPath: /.storage

# -- double-take configuration settings.
# This will be copied into the container's persistent storage at first run only.
# Further configuration should be done in the application itself!
# See [project documentation](https://github.com/jakowenko/double-take#configuration) for more information.
# @default -- See values.yaml
config:
  # enable authentication for ui and api (default: false)
  auth: false

  # if authentication is enabled
  # age of access token in api response and mqtt topics (default: shown below)
  # expressed in seconds or a string describing a time span zeit/ms
  # https://github.com/vercel/ms
  token:
    image: 24h

  # enable mqtt subscribing and publishing (default: shown below)
  mqtt:
    host:
    username:
    password:

    topics:
      # mqtt topic for frigate message subscription
      frigate: frigate/events
      #  mqtt topic for home assistant discovery subscription
      homeassistant: homeassistant
      # mqtt topic where matches are published by name
      matches: double-take/matches
      # mqtt topic where matches are published by camera name
      cameras: double-take/cameras

  # global detect settings (default: shown below)
  detect:
    match:
      # save match images
      save: true
      # include base64 encoded string in api results and mqtt messages
      # options: true, false, box
      base64: false
      # minimum confidence needed to consider a result a match
      confidence: 60
      # hours to keep match images until they are deleted
      purge: 168
      # minimum area in pixels to consider a result a match
      min_area: 10000

    unknown:
      # save unknown images
      save: true
      # include base64 encoded string in api results and mqtt messages
      # options: true, false, box
      base64: false
      # minimum confidence needed before classifying a name as unknown
      confidence: 40
      # hours to keep unknown images until they are deleted
      purge: 8
      # minimum area in pixels to keep an unknown result
      min_area: 0

  # frigate settings (default: shown below)
  frigate:
    url:

    # object labels that are allowed for facial recognition
    labels:
      - person

    attempts:
      # number of times double take will request a frigate latest.jpg for facial recognition
      latest: 10
      # number of times double take will request a frigate snapshot.jpg for facial recognition
      snapshot: 10
      # process frigate images from frigate/+/person/snapshot topics
      mqtt: true
      # add a delay expressed in seconds between each detection loop
      delay: 0

    image:
      # height of frigate image passed for facial recognition
      height: 500

    # only process images from specific cameras
    cameras:
      # - front-door
      # - garage

    # only process images from specific zones
    zones:
      # - camera: garage
      #   zone: driveway

    # override frigate attempts and image per camera
    events:
      # front-door:
      #   attempts:
      #     # number of times double take will request a frigate latest.jpg for facial recognition
      #     latest: 5
      #     # number of times double take will request a frigate snapshot.jpg for facial recognition
      #     snapshot: 5
      #     # process frigate images from frigate/<camera-name>/person/snapshot topic
      #     mqtt: false
      #     # add a delay expressed in seconds between each detection loop
      #     delay: 1

      #   image:
      #     # height of frigate image passed for facial recognition (only if using default latest.jpg and snapshot.jpg)
      #     height: 1000
      #     # custom image that will be used in place of latest.jpg
      #     latest: http://camera-url.com/image.jpg
      #     # custom image that will be used in place of snapshot.jpg
      #     snapshot: http://camera-url.com/image.jpg

  # camera settings (default: shown below)
  cameras:
    front-door:
      # apply masks before processing image
      # masks:
      #   # list of x,y coordinates to define the polygon of the zone
      #   coordinates:
      #     - 1920,0,1920,328,1638,305,1646,0
      #   # show the mask on the final saved image (helpful for debugging)
      #   visible: false
      #   # size of camera stream used in resizing masks
      #   size: 1920x1080

      # override global detect variables per camera
      # detect:
      #   match:
      #     # save match images
      #     save: true
      #     # include base64 encoded string in api results and mqtt messages
      #     # options: true, false, box
      #     base64: false
      #     # minimum confidence needed to consider a result a match
      #     confidence: 60
      #     # minimum area in pixels to consider a result a match
      #     min_area: 10000

      #   unknown:
      #     # save unknown images
      #     save: true
      #     # include base64 encoded string in api results and mqtt messages
      #     # options: true, false, box
      #     base64: false
      #     # minimum confidence needed before classifying a match name as unknown
      #     confidence: 40
      #     # minimum area in pixels to keep an unknown result
      #     min_area: 0

      # snapshot:
      #   # process any jpeg encoded mqtt topic for facial recognition
      #   topic:
      #   # process any http image for facial recognition
      #   url:

  # detector settings (default: shown below)
  detectors:
    compreface:
      # -- enable or disable the compreface detector
      enabled: true
      url:
      # recognition api key
      key:
      # number of seconds before the request times out and is aborted
      timeout: 15
      # minimum required confidence that a recognized face is actually a face
      # value is between 0.0 and 1.0
      det_prob_threshold: 0.8
      # comma-separated slugs of face plugins
      # https://github.com/exadel-inc/CompreFace/blob/master/docs/Face-services-and-plugins.md)
      # face_plugins: mask,gender,age

    deepstack:
      # -- enable or disable the deepstack detector
      enabled: false
      url:
      key:
      # -- number of seconds before the request times out and is aborted
      timeout: 15

    facebox:
      # -- enable or disable the facebox detector
      enabled: false
      url:
      # -- number of seconds before the request times out and is aborted
      timeout: 15

  # schedule settings (default: shown below)
  schedule:
    # disable recognition if conditions are met
    disable:
      # - days:
      #     - monday
      #     - tuesday
      #   times:
      #     - 20:00-23:59
      #   cameras:
      #     - office
      # - days:
      #     - tuesday
      #     - wednesday
      #   times:
      #     - 13:00-15:00
      #     - 18:00-20:00
      #   cameras:
      #     - living-room

  # notify settings (default: shown below)
  notify:
    gotify:
      # -- enable gotify
      enabled: true
      url:
      token:
      priority: 5

      # only notify from specific cameras
      # cameras:
      #   - front-door
      #   - garage

      # only notify from specific zones
      # zones:
      #   - camera: garage
      #     zone: driveway

  # time settings (default: shown below)
  time:
    # defaults to iso 8601 format with support for token-based formatting
    # https://github.com/moment/luxon/blob/master/docs/formatting.md#table-of-tokens
    format:
    # time zone used in logs
    timezone: UTC

  # log settings (default: shown below)
  # options: silent, error, warn, info, http, verbose, debug, silly
  logs:
    level: info

  # ui settings (default: shown below)
  ui:
    pagination:
      # number of results per page
      limit: 50

    thumbnails:
      # value between 0-100
      quality: 95
      # value in pixels
      width: 500

    logs:
      # number of lines displayed
      lines: 500
