openapi: 3.0.3 info: title: 'Laravel API Documentation' description: 'API documentation for hydroponic operations and performance tracking' version: 1.0.0 servers: - url: 'http://localhost' tags: - name: Authentication description: "\nAPIs for user authentication" - name: Farms description: "\nAPIs for managing farms" components: securitySchemes: default: type: http scheme: bearer description: 'You can retrieve your JWT token by logging in via the `/api/login` endpoint.' security: - default: [] paths: /api/login: post: summary: Login operationId: login description: 'Authenticate a user and return JWT tokens.' parameters: [] responses: 200: description: '' content: application/json: schema: type: object example: user: id: uuid name: 'Admin User' role: SUPER_ADMIN email: admin@example.com farm_id: null permissions: [] access_token: jwt-token token_type: bearer expires_in: 3600 properties: user: type: object properties: id: type: string example: uuid name: type: string example: 'Admin User' role: type: string example: SUPER_ADMIN email: type: string example: admin@example.com farm_id: type: string example: null nullable: true permissions: type: array example: [] access_token: type: string example: jwt-token token_type: type: string example: bearer expires_in: type: integer example: 3600 401: description: '' content: application/json: schema: type: object example: error: 'Invalid credentials' properties: error: type: string example: 'Invalid credentials' tags: - Authentication requestBody: required: true content: application/json: schema: type: object properties: email: type: string description: "The user's email." example: admin@example.com password: type: string description: "The user's password." example: password required: - email - password security: [] /api/register: post: summary: Register operationId: register description: 'Register a new user.' parameters: [] responses: 201: description: '' content: application/json: schema: type: object example: id: uuid name: 'John Doe' email: john@example.com role: FARMER permissions: [] properties: id: type: string example: uuid name: type: string example: 'John Doe' email: type: string example: john@example.com role: type: string example: FARMER permissions: type: array example: [] tags: - Authentication requestBody: required: true content: application/json: schema: type: object properties: name: type: string description: "The user's name." example: 'John Doe' email: type: string description: "The user's email." example: john@example.com password: type: string description: "The user's password." example: password123 role: type: string description: "The user's role." example: FARMER farm_id: type: string description: 'optional The farm ID.' example: uuid nullable: true permissions: type: array description: "optional The user's permissions." example: - consequatur items: type: string nullable: true required: - name - email - password - role /api/refresh: post: summary: 'Refresh token' operationId: refreshToken description: 'Refresh the JWT token.' parameters: [] responses: 200: description: '' content: application/json: schema: type: object example: access_token: new-jwt-token token_type: bearer expires_in: 3600 properties: access_token: type: string example: new-jwt-token token_type: type: string example: bearer expires_in: type: integer example: 3600 tags: - Authentication /api/logout: post: summary: Logout operationId: logout description: "Invalidate the user's token." parameters: [] responses: 200: description: '' content: application/json: schema: type: object example: message: 'Successfully logged out' properties: message: type: string example: 'Successfully logged out' tags: - Authentication /api/me: get: summary: 'Get current user' operationId: getCurrentUser description: "Get the authenticated user's information." parameters: [] responses: 200: description: '' content: application/json: schema: type: object example: id: uuid name: 'Admin User' email: admin@example.com role: SUPER_ADMIN farm_id: null permissions: [] properties: id: type: string example: uuid name: type: string example: 'Admin User' email: type: string example: admin@example.com role: type: string example: SUPER_ADMIN farm_id: type: string example: null nullable: true permissions: type: array example: [] tags: - Authentication /api/farms: get: summary: 'List farms' operationId: listFarms description: 'Get a list of all farms.' parameters: [] responses: 200: description: '' content: application/json: schema: type: array items: type: object properties: id: type: string example: uuid name: type: string example: 'Farm 1' status: type: string example: ACTIVE location: type: string example: 'Location 1' created_at: type: string example: '2023-01-01T00:00:00.000000Z' updated_at: type: string example: '2023-01-01T00:00:00.000000Z' example: - id: uuid name: 'Farm 1' status: ACTIVE location: 'Location 1' created_at: '2023-01-01T00:00:00.000000Z' updated_at: '2023-01-01T00:00:00.000000Z' tags: - Farms post: summary: 'Create farm' operationId: createFarm description: 'Create a new farm.' parameters: [] responses: 201: description: '' content: application/json: schema: type: object example: id: uuid name: 'New Farm' status: ACTIVE location: 'City, Country' created_at: '2023-01-01T00:00:00.000000Z' updated_at: '2023-01-01T00:00:00.000000Z' properties: id: type: string example: uuid name: type: string example: 'New Farm' status: type: string example: ACTIVE location: type: string example: 'City, Country' created_at: type: string example: '2023-01-01T00:00:00.000000Z' updated_at: type: string example: '2023-01-01T00:00:00.000000Z' tags: - Farms requestBody: required: true content: application/json: schema: type: object properties: name: type: string description: 'The farm name.' example: 'New Farm' status: type: string description: 'optional The farm status.' example: ACTIVE location: type: string description: 'optional The farm location.' example: 'City, Country' nullable: true required: - name '/api/farms/{id}': get: summary: 'Get farm' operationId: getFarm description: 'Get a specific farm by ID.' parameters: [] responses: 200: description: '' content: application/json: schema: type: object example: id: uuid name: 'Farm 1' status: ACTIVE location: 'Location 1' created_at: '2023-01-01T00:00:00.000000Z' updated_at: '2023-01-01T00:00:00.000000Z' properties: id: type: string example: uuid name: type: string example: 'Farm 1' status: type: string example: ACTIVE location: type: string example: 'Location 1' created_at: type: string example: '2023-01-01T00:00:00.000000Z' updated_at: type: string example: '2023-01-01T00:00:00.000000Z' tags: - Farms put: summary: 'Update farm' operationId: updateFarm description: 'Update a specific farm.' parameters: [] responses: 200: description: '' content: application/json: schema: type: object example: id: uuid name: 'Updated Farm' status: MAINTENANCE location: 'New City' created_at: '2023-01-01T00:00:00.000000Z' updated_at: '2023-01-01T00:00:00.000000Z' properties: id: type: string example: uuid name: type: string example: 'Updated Farm' status: type: string example: MAINTENANCE location: type: string example: 'New City' created_at: type: string example: '2023-01-01T00:00:00.000000Z' updated_at: type: string example: '2023-01-01T00:00:00.000000Z' tags: - Farms requestBody: required: false content: application/json: schema: type: object properties: name: type: string description: 'optional The farm name.' example: 'Updated Farm' status: type: string description: 'optional The farm status.' example: MAINTENANCE location: type: string description: 'optional The farm location.' example: 'New City' delete: summary: 'Delete farm' operationId: deleteFarm description: 'Delete a specific farm.' parameters: [] responses: 200: description: '' content: application/json: schema: type: object example: message: 'Farm deleted' properties: message: type: string example: 'Farm deleted' tags: - Farms parameters: - in: path name: id description: 'The farm ID.' example: uuid required: true schema: type: string