const loginEndpoint = {
  '/lst/api/user/login': {
    post: {
      tags: ['Authentication'],
      summary: 'Login to get a token',
      description: 'User enters username and password, gets back a JWT token and session data',
      
      // What the user sends you
      requestBody: {
        required: true,
        content: {
          'application/json': {
            schema: {
              type: 'object',
              required: ['username', 'password'],
              properties: {
                username: {
                  type: 'string',
                  example: 'smith01'
                },
                password: {
                  type: 'string',
                  example: 'MyPassword123'
                }
              }
            }
          }
        }
      },
      
      // What you send back to the user
      responses: {
        // SUCCESS - Login worked
        200: {
          description: 'Login successful',
          content: {
            'application/json': {
              schema: {
                type: 'object',
                properties: {
                  success: {
                    type: 'boolean',
                    example: true
                  },
                  message: {
                    type: 'string',
                    example: 'Login successful'
                  },
                  data: {
                    type: 'object',
                    properties: {
                      token: {
                        type: 'string',
                        example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
                      },
                      user: {
                        type: 'object',
                        properties: {
                          id: {
                            type: 'string',
                            example: '12345'
                          },
                          email: {
                            type: 'string',
                            example: 'user@example.com'
                          },
                          username: {
                            type: 'string',
                            example: 'johndoe'
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        
        // ERROR - Wrong password or email
        401: {
          description: 'Wrong email or password',
          content: {
            'application/json': {
              schema: {
                type: 'object',
                properties: {
                  success: {
                    type: 'boolean',
                    example: false
                  },
                  message: {
                    type: 'string',
                    example: 'Invalid credentials'
                  }
                }
              }
            }
          }
        },
        
        // ERROR - Missing fields
        400: {
          description: 'Missing email or password',
          content: {
            'application/json': {
              schema: {
                type: 'object',
                properties: {
                  success: {
                    type: 'boolean',
                    example: false
                  },
                  message: {
                    type: 'string',
                    example: 'Email and password are required'
                  }
                }
              }
            }
          }
        }
      }
    }
  }
};

export default loginEndpoint;