label_cycle:
  name: Label Cycle
  description: Assign an existing profile to a past cycle, or remove the label.
  fields:
    device_id:
      name: Device
      description: The WashData device to label.
      required: true
      selector:
        device:
          integration: ha_washdata
    cycle_id:
      name: Cycle ID
      description: The ID of the cycle to label.
      required: true
      selector:
        text:
    profile_name:
      name: Profile Name
      description: The name of an existing profile (create profiles in Manage Profiles menu). Leave blank to remove label.
      required: false
      selector:
        text:

create_profile:
  name: Create Profile
  description: Create a new profile (standalone or based on a reference cycle).
  fields:
    device_id:
      name: Device
      description: The WashData device.
      required: true
      selector:
        device:
          integration: ha_washdata
    profile_name:
      name: Profile Name
      description: Name for the new profile (e.g. "Heavy Duty", "Delicates").
      required: true
      selector:
        text:
    reference_cycle_id:
      name: Reference Cycle ID
      description: Optional cycle ID to base this profile on.
      required: false
      selector:
        text:

delete_profile:
  name: Delete Profile
  description: Delete a profile and optionally unlabel cycles using it.
  fields:
    device_id:
      name: Device
      description: The WashData device.
      required: true
      selector:
        device:
          integration: ha_washdata
    profile_name:
      name: Profile Name
      description: The profile to delete.
      required: true
      selector:
        text:
    unlabel_cycles:
      name: Unlabel Cycles
      description: Remove profile label from cycles using this profile.
      required: false
      default: true
      selector:
        boolean:

auto_label_cycles:
  name: Auto-Label Old Cycles
  description: Retroactively label unlabeled cycles using profile matching.
  fields:
    device_id:
      name: Device
      description: The WashData device.
      required: true
      selector:
        device:
          integration: ha_washdata
    confidence_threshold:
      name: Confidence Threshold
      description: Minimum match confidence (0.50-0.95) to apply labels.
      required: false
      default: 0.75
      selector:
        number:
          min: 0.50
          max: 0.95
          step: 0.05

export_config:
  name: Export Config
  description: Export this washer's profiles and cycles to a JSON file (per device).
  fields:
    device_id:
      name: Device
      description: The WashData device to export.
      required: true
      selector:
        device:
          integration: ha_washdata
    path:
      name: Path
      description: Optional absolute file path to write (defaults to /config/ha_washdata_export_<entry>.json).
      required: false
      selector:
        text:

import_config:
  name: Import Config
  description: Import profiles and cycles for this washer from a JSON export file.
  fields:
    device_id:
      name: Device
      description: The WashData device to import into.
      required: true
      selector:
        device:
          integration: ha_washdata
    path:
      name: Path
      description: Absolute path to the export JSON file to import.
      required: true
      selector:
        text:

submit_cycle_feedback:
  name: Submit Cycle Feedback
  description: >
    Confirm or correct an auto-detected program after a completed cycle.
    Provide either `entry_id` (advanced) or `device_id` (recommended).
  fields:
    device_id:
      name: Device
      description: The WashData device (recommended instead of entry_id).
      required: false
      selector:
        device:
          integration: ha_washdata
    entry_id:
      name: Entry ID
      description: The config entry id for the device (alternative to device_id).
      required: false
      selector:
        text:
    cycle_id:
      name: Cycle ID
      description: The cycle id shown in the feedback notification / logs.
      required: true
      selector:
        text:
    user_confirmed:
      name: Confirm Detected Program
      description: Set true if the detected program is correct.
      required: true
      selector:
        boolean:
    corrected_profile:
      name: Corrected Profile
      description: If not confirmed, provide the correct profile/program name.
      required: false
      selector:
        text:
    corrected_duration:
      name: Corrected Duration (seconds)
      description: Optional corrected duration in seconds.
      required: false
      selector:
        number:
          min: 0
          max: 86400
          step: 1
          mode: box
    notes:
      name: Notes
      description: Optional notes about this cycle.
      required: false
      selector:
        text:

record_start:
  name: Record Cycle Start
  description: Start manually recording a clean cycle (bypasses all matching logic).
  fields:
    device_id:
      name: Device
      description: The WashData device to record.
      required: true
      selector:
        device:
          integration: ha_washdata

record_stop:
  name: Record Cycle Stop
  description: Stop manual recording.
  fields:
    device_id:
      name: Device
      description: The WashData device to stop recording.
      required: true
      selector:
        device:
          integration: ha_washdata

trim_cycle:
  name: Trim Cycle
  description: >
    Trim the power data of a past cycle to a specific time window.
    Offsets are renormalized to start from 0 and the cycle duration is updated.
  fields:
    device_id:
      name: Device
      description: The WashData device.
      required: true
      selector:
        device:
          integration: ha_washdata
    cycle_id:
      name: Cycle ID
      description: The ID of the cycle to trim.
      required: true
      selector:
        text:
    trim_start_s:
      name: Trim Start (seconds)
      description: Keep data from this offset (seconds from cycle start). Default 0.
      required: false
      default: 0
      selector:
        number:
          min: 0
          max: 86400
          step: 1
          mode: box
    trim_end_s:
      name: Trim End (seconds)
      description: Keep data up to this offset (seconds from cycle start). Default = full duration.
      required: false
      selector:
        number:
          min: 1
          max: 86400
          step: 1
          mode: box

pause_cycle:
  name: Pause Cycle
  description: Pause the active cycle so a power drop won't finalize it (optionally cuts switch power).
  fields:
    device_id:
      name: Device
      description: The WashData device whose active cycle to pause.
      required: true
      selector:
        device:
          integration: ha_washdata

resume_cycle:
  name: Resume Cycle
  description: Resume a previously paused cycle.
  fields:
    device_id:
      name: Device
      description: The WashData device whose cycle to resume.
      required: true
      selector:
        device:
          integration: ha_washdata

trigger_ml_training:
  name: Trigger ML Training
  description: Manually retrain the on-device ML models from this device's own labelled cycles (experimental; requires ML training enabled).
  fields:
    device_id:
      name: Device
      description: The WashData device to retrain models for.
      required: true
      selector:
        device:
          integration: ha_washdata
