# Coercion Rules Template
# Pre-validation data type transformations
#
# Usage:
#   Coercion rules transform input data BEFORE Pydantic validation.
#   Useful for handling messy data from external sources.
#
# Available coercions:
#   - coerce_to_string          : Convert to string
#   - coerce_to_integer         : Convert to int (handles "123", 123.0)
#   - coerce_to_float           : Convert to float
#   - coerce_to_boolean         : Convert to bool ("true"/"false", 0/1)
#   - coerce_to_datetime        : Parse datetime strings (ISO format)
#   - coerce_to_date            : Parse date strings
#   - coerce_to_uuid            : Parse UUID strings
#   - coerce_to_lowercase       : Convert string to lowercase
#   - coerce_to_uppercase       : Convert string to uppercase
#   - coerce_to_stripped_string : Trim whitespace
#   - coerce_to_list            : Wrap single value in list
#   - coerce_to_json            : Parse JSON string
#   - coerce_empty_to_null      : Convert "" to None
#   - coerce_to_none            : Always return None
#
# Nullable variants (preserve None values):
#   - coerce_to_nullable_string
#   - coerce_to_nullable_integer
#   - coerce_to_nullable_float
#   - coerce_to_nullable_datetime
#   - coerce_to_nullable_uuid
#   - coerce_to_nullable_json

title: my_coercion_rules
description: Coercion rules for data transformation
version: "1.0.0"

rules:
  # String fields
  id: coerce_to_string
  name: coerce_to_stripped_string
  status: coerce_to_lowercase

  # Numeric fields
  count: coerce_to_integer
  amount: coerce_to_float

  # Boolean
  is_active: coerce_to_boolean

  # Datetime
  created_at: coerce_to_datetime

  # Nullable fields (use nullable variants)
  notes: coerce_to_nullable_string
  email: coerce_to_nullable_string

  # UUID
  uuid: coerce_to_uuid
