swagger: '2.0'
info:
  title: Gardiq API
  description: API documentation for Gardiq
  termsOfService: https://www.google.com/policies/terms/
  contact:
    email: contact@gardiq.local
  license:
    name: BSD License
  version: v1
host: plan.yarinde.nl
schemes:
- http
basePath: /
consumes:
- application/json
produces:
- application/json
securityDefinitions:
  Basic:
    type: basic
security:
- Basic: []
paths:
  /api/:
    get:
      operationId: api_list
      description: API root endpoint.
      parameters: []
      responses:
        '200':
          description: ''
      tags:
      - api
    parameters: []
  /api/auth/request-code/:
    post:
      operationId: api_auth_request-code_create
      summary: |-
        Request a one-time login code.
        POST /api/auth/request-code/
      description: |-
        Expected payload:
        {
            "email": "user@example.com"
        }
      parameters: []
      responses:
        '201':
          description: ''
      tags:
      - api
    parameters: []
  /api/auth/verify-code/:
    post:
      operationId: api_auth_verify-code_create
      summary: |-
        Verify a one-time login code and authenticate user.
        POST /api/auth/verify-code/
      description: |-
        Expected payload:
        {
            "email": "user@example.com",
            "code": "123456"
        }
      parameters: []
      responses:
        '201':
          description: ''
      tags:
      - api
    parameters: []
  /api/csrf/:
    get:
      operationId: api_csrf_list
      description: Health check endpoint for monitoring.
      parameters: []
      responses:
        '200':
          description: ''
      tags:
      - api
    parameters: []
  /api/feedback/:
    post:
      operationId: api_feedback_create
      summary: |-
        Create a feedback entry.
        POST /api/feedback/
      description: |-
        Expected payload:
        {
            "email": "user@example.com",
            "feedback": "Feedback text",
            "page": "https://example.com/page",
            "userAgent": "Mozilla/5.0..."
        }
      parameters: []
      responses:
        '201':
          description: ''
      tags:
      - api
    parameters: []
  /api/garden-border/:
    get:
      operationId: api_garden-border_list
      summary: List garden plans.
      description: |-
        Requires authentication via token. Returns only garden plans
        belonging to the authenticated user (filtered by user's email).
      parameters:
      - name: page
        in: query
        description: A page number within the paginated result set.
        required: false
        type: integer
      responses:
        '200':
          description: ''
          schema:
            required:
            - count
            - results
            type: object
            properties:
              count:
                type: integer
              next:
                type: string
                format: uri
                x-nullable: true
              previous:
                type: string
                format: uri
                x-nullable: true
              results:
                type: array
                items:
                  $ref: '#/definitions/GardenPlan'
      tags:
      - api
    post:
      operationId: api_garden-border_create
      description: Create a new garden plan.
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/GardenPlan'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/GardenPlan'
      tags:
      - api
    parameters: []
  /api/garden-border/{uuid}/:
    get:
      operationId: api_garden-border_read
      summary: Retrieve a garden plan by UUID.
      description: |-
        This endpoint is intentionally public (no authentication required)
        to allow users to access their plans via direct email links without
        needing to authenticate first. Ownership validation is not performed
        as users receive unique UUIDs in their email notifications.
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/GardenPlan'
      tags:
      - api
    put:
      operationId: api_garden-border_update
      description: Update a garden plan (partial update supported).
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/GardenPlan'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/GardenPlan'
      tags:
      - api
    patch:
      operationId: api_garden-border_partial_update
      description: |-
        ViewSet for GardenPlan CRUD operations (renamed from GardenBorder).
        Supports retrieval by UUID via custom action.
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/GardenPlan'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/GardenPlan'
      tags:
      - api
    delete:
      operationId: api_garden-border_delete
      description: Delete a garden plan.
      parameters: []
      responses:
        '204':
          description: ''
      tags:
      - api
    parameters:
    - name: uuid
      in: path
      required: true
      type: string
      format: uuid
  /api/garden-plan/generate-image/:
    post:
      operationId: api_garden-plan_generate-image_create
      summary: |-
        Generate a border image using configured image generation strategy.
        POST /api/garden-plan/generate-image/
      description: |-
        Expected payload:
        {
            "borderUuid": "uuid-string",
            "borderIndex": 0,
            "plantDetails": {...}
        }

        Image generation strategy is configured via IMAGE_GENERATION_STRATEGY env var.
      parameters: []
      responses:
        '201':
          description: ''
      tags:
      - api
    parameters: []
  /api/garden-plan/generate/:
    post:
      operationId: api_garden-plan_generate_create
      summary: |-
        Generate a garden plan using OpenAI.
        POST /api/garden-plan/generate/
      description: |-
        Expected payload:
        {
            "email": "user@example.com",
            "gardenAtmosphere": "Natuurlijk/wild",
            "numberOfBorders": 2,
            "borders": [...],
            "newsletter": false
        }
      parameters: []
      responses:
        '201':
          description: ''
      tags:
      - api
    parameters: []
  /api/garden-plan/status/{uuid}/:
    get:
      operationId: api_garden-plan_status_read
      description: Get current generation status for a garden plan.
      parameters: []
      responses:
        '200':
          description: ''
      tags:
      - api
    parameters:
    - name: uuid
      in: path
      required: true
      type: string
  /api/health/:
    get:
      operationId: api_health_list
      description: Health check endpoint for monitoring.
      parameters: []
      responses:
        '200':
          description: ''
      tags:
      - api
    parameters: []
  /api/plants/:
    post:
      operationId: api_plants_create
      summary: |-
        Get plants by webshopIds (strings).
        POST /api/plants/
      description: |-
        Expected payload:
        {
            "ids": ["49362475581743", "48327104889135"]  # webshopIds (strings)
        }
      parameters: []
      responses:
        '201':
          description: ''
      tags:
      - api
    parameters: []
definitions:
  GardenPlan:
    required:
    - email
    type: object
    properties:
      id:
        title: ID
        type: integer
        readOnly: true
      uuid:
        title: Uuid
        type: string
        format: uuid
        readOnly: true
      email:
        title: Email
        type: string
        format: email
        maxLength: 254
        minLength: 1
      gardenAtmosphere:
        title: Gardenatmosphere
        type: string
        readOnly: true
        minLength: 1
      numberOfBorders:
        title: Numberofborders
        type: string
        readOnly: true
      borders:
        title: Borders
        type: string
        readOnly: true
      recommendations:
        title: Recommendations
        type: string
        readOnly: true
      imageUrls:
        title: Imageurls
        type: string
        readOnly: true
      imageRegenerationCounts:
        title: Imageregenerationcounts
        type: string
        readOnly: true
      status:
        title: Status
        type: string
        enum:
        - pending
        - completed
        - failed
      newsletter:
        title: Newsletter
        type: boolean
      notificationEmail:
        title: Notificationemail
        type: string
        format: email
        readOnly: true
        minLength: 1
      generalNotes:
        title: Generalnotes
        type: string
        readOnly: true
        minLength: 1
      createdAt:
        title: Createdat
        type: string
        format: date-time
        readOnly: true
      updatedAt:
        title: Updatedat
        type: string
        format: date-time
        readOnly: true
