complete:
  name: Complete Maintenance
  description: Mark a maintenance task as completed.
  fields:
    entity_id:
      name: Entity
      description: The maintenance sensor entity to complete.
      required: true
      selector:
        entity:
          domain: sensor
          integration: maintenance_supporter
    notes:
      name: Notes
      description: Optional notes about the maintenance performed.
      selector:
        text:
    cost:
      name: Cost
      description: Cost of the maintenance performed.
      selector:
        number:
          min: 0
          step: 0.01
          mode: box
    duration:
      name: Duration (minutes)
      description: Duration of the maintenance in minutes.
      selector:
        number:
          min: 0
          max: 1440
          step: 1
          mode: box
    reading_value:
      name: Reading value
      description: Recorded value for reading-type tasks (meter reading, level check).
      selector:
        number:
          mode: box
          step: any

reset:
  name: Reset Maintenance
  description: Reset the last performed date of a maintenance task.
  fields:
    entity_id:
      name: Entity
      description: The maintenance sensor entity to reset.
      required: true
      selector:
        entity:
          domain: sensor
          integration: maintenance_supporter
    date:
      name: Date
      description: The date to set as last performed. Defaults to today.
      selector:
        date:

skip:
  name: Skip Maintenance
  description: Skip the current maintenance cycle.
  fields:
    entity_id:
      name: Entity
      description: The maintenance sensor entity to skip.
      required: true
      selector:
        entity:
          domain: sensor
          integration: maintenance_supporter
    reason:
      name: Reason
      description: Optional reason for skipping.
      selector:
        text:

export_data:
  name: Export Data
  description: Export all maintenance data as JSON or YAML.
  fields:
    format:
      name: Format
      description: Output format for the exported data.
      default: "json"
      selector:
        select:
          options:
            - "json"
            - "yaml"
    include_history:
      name: Include History
      description: Whether to include task history entries in the export.
      default: true
      selector:
        boolean:

add_object:
  name: Add Object
  description: Create a new maintenance object (device). Returns the new entry_id.
  fields:
    name:
      name: Name
      description: Name of the object/device.
      required: true
      selector:
        text:
    area_id:
      name: Area
      description: Area to assign the device to.
      selector:
        area:
    manufacturer:
      name: Manufacturer
      selector:
        text:
    model:
      name: Model
      selector:
        text:
    serial_number:
      name: Serial number
      selector:
        text:
    installation_date:
      name: Installation date
      selector:
        date:
    warranty_expiry:
      name: Warranty expiry
      description: Warranty expiry date (used for asset tracking and reminders).
      selector:
        date:
    documentation_url:
      name: Documentation URL
      description: Link to a manual or vendor page (http/https only).
      selector:
        text:
    notes:
      name: Notes
      selector:
        text:
          multiline: true

add_task:
  name: Add Task
  description: Add a maintenance task to an existing object. Returns the new task_id.
  fields:
    entry_id:
      name: Object
      description: The maintenance object to add the task to.
      required: true
      selector:
        config_entry:
          integration: maintenance_supporter
    name:
      name: Name
      description: Name of the task.
      required: true
      selector:
        text:
    task_type:
      name: Task type
      description: Free-form category (e.g. inspection, service, custom).
      selector:
        text:
    schedule_type:
      name: Schedule type
      description: "time_based (interval) or sensor_based. Default: time_based."
      selector:
        text:
    interval_days:
      name: Interval
      description: Interval length between occurrences (for time-based tasks), combined with interval_unit.
      selector:
        number:
          min: 1
          max: 3650
          step: 1
          mode: box
    interval_unit:
      name: Interval unit
      description: "Unit for the interval: days, weeks, months or years. Default: days."
      selector:
        select:
          options:
            - days
            - weeks
            - months
            - years
    due_date:
      name: Due date
      description: Due date (YYYY-MM-DD) for a one-time task (schedule_type one_time).
      selector:
        text:
    schedule:
      name: Calendar schedule
      description: >-
        Nested recurrence for the calendar kinds, e.g. {"kind": "nth_weekday",
        "nth": 1, "weekday": 5} for the 1st Saturday (weekday 0=Mon … 6=Sun),
        {"kind": "weekdays", "weekdays": [0, 3]} for Mon & Thu, or {"kind":
        "day_of_month", "day": 15}. Takes precedence over interval_days /
        schedule_type.
      selector:
        object:
    warning_days:
      name: Warning (days)
      description: Days before due to enter the due-soon window.
      default: 7
      selector:
        number:
          min: 0
          max: 365
          step: 1
          mode: box
    enabled:
      name: Enabled
      default: true
      selector:
        boolean:
    notes:
      name: Notes
      selector:
        text:
          multiline: true

update_task:
  name: Update Task
  description: Update the common fields of an existing maintenance task. Only the provided fields change.
  fields:
    entry_id:
      name: Object
      description: The maintenance object the task belongs to.
      required: true
      selector:
        config_entry:
          integration: maintenance_supporter
    task_id:
      name: Task ID
      description: The id of the task to update (see list_tasks).
      required: true
      selector:
        text:
    name:
      name: Name
      description: New name of the task.
      selector:
        text:
    task_type:
      name: Task type
      description: Category (cleaning, inspection, replacement, calibration, service, reading, custom).
      selector:
        text:
    schedule_type:
      name: Schedule type
      description: time_based (interval), sensor_based, one_time or manual.
      selector:
        text:
    interval_days:
      name: Interval
      description: Interval length between occurrences, combined with interval_unit.
      selector:
        number:
          min: 1
          max: 3650
          mode: box
    interval_unit:
      name: Interval unit
      description: days, weeks, months or years.
      selector:
        select:
          options: ["days", "weeks", "months", "years"]
    due_date:
      name: Due date
      description: Due date for one-time tasks (YYYY-MM-DD).
      selector:
        date:
    schedule:
      name: Schedule (calendar recurrence)
      description: "Nested recurrence object for the calendar kinds, e.g. {\"kind\": \"day_of_month\", \"day\": -1, \"business\": true}. Takes precedence over the flat fields."
      selector:
        object:
    warning_days:
      name: Warning days
      description: Days before due when the task turns due-soon.
      selector:
        number:
          min: 0
          max: 365
          mode: box
    enabled:
      name: Enabled
      description: Whether the task is active.
      selector:
        boolean:
    notes:
      name: Notes
      description: Free-form notes on the task.
      selector:
        text:
    priority:
      name: Priority
      description: low, normal or high.
      selector:
        select:
          options: ["low", "normal", "high"]
    labels:
      name: Labels
      description: List of tags for filtering and reporting.
      selector:
        object:

delete_task:
  name: Delete Task
  description: Delete a maintenance task including its history. This cannot be undone — consider archiving via the panel instead.
  fields:
    entry_id:
      name: Object
      description: The maintenance object the task belongs to.
      required: true
      selector:
        config_entry:
          integration: maintenance_supporter
    task_id:
      name: Task ID
      description: The id of the task to delete (see list_tasks).
      required: true
      selector:
        text:

list_tasks:
  name: List Tasks
  description: Return a snapshot of active maintenance tasks (id, name, status, next due) for automations, scripts and voice. Supports filtering by object and status.
  fields:
    entry_id:
      name: Object
      description: Only return tasks of this maintenance object.
      selector:
        config_entry:
          integration: maintenance_supporter
    status:
      name: Status
      description: Only return tasks with this status.
      selector:
        select:
          options: ["ok", "due_soon", "overdue", "triggered"]
