basePath: /api/v1
definitions:
  health.HealthResponse:
    properties:
      services:
        additionalProperties:
          type: string
        type: object
      status:
        type: string
      system:
        $ref: '#/definitions/health.SystemInfo'
      timestamp:
        type: string
      uptime:
        type: string
      version:
        type: string
    type: object
  health.SystemInfo:
    properties:
      go_version:
        type: string
      mem_alloc_mb:
        type: integer
      num_cpu:
        type: integer
      num_goroutine:
        type: integer
    type: object
  request.ChangePasswordRequest:
    properties:
      confirm_password:
        type: string
      current_password:
        type: string
      new_password:
        minLength: 8
        type: string
    required:
    - confirm_password
    - current_password
    - new_password
    type: object
  request.CreateUserRequest:
    properties:
      email:
        type: string
      full_name:
        maxLength: 255
        minLength: 2
        type: string
      nik:
        type: string
      nip:
        type: string
      password:
        minLength: 8
        type: string
      phone:
        type: string
      role_ids:
        items:
          type: string
        minItems: 1
        type: array
      sip_number:
        type: string
      specialization:
        type: string
      str_number:
        type: string
      username:
        maxLength: 50
        minLength: 3
        type: string
    required:
    - email
    - full_name
    - password
    - role_ids
    - username
    type: object
  request.ForgotPasswordRequest:
    properties:
      email:
        type: string
    required:
    - email
    type: object
  request.LoginRequest:
    properties:
      password:
        minLength: 8
        type: string
      username:
        maxLength: 50
        minLength: 3
        type: string
    required:
    - password
    - username
    type: object
  request.RefreshTokenRequest:
    properties:
      refresh_token:
        type: string
    required:
    - refresh_token
    type: object
  request.ResetPasswordRequest:
    properties:
      confirm_password:
        type: string
      password:
        minLength: 8
        type: string
      token:
        type: string
    required:
    - confirm_password
    - password
    - token
    type: object
  request.UpdateUserRequest:
    properties:
      email:
        type: string
      full_name:
        maxLength: 255
        minLength: 2
        type: string
      nik:
        type: string
      nip:
        type: string
      phone:
        type: string
      role_ids:
        items:
          type: string
        type: array
      sip_number:
        type: string
      specialization:
        type: string
      status:
        enum:
        - active
        - inactive
        - suspended
        type: string
      str_number:
        type: string
    type: object
  response.Error:
    properties:
      code:
        type: string
      field:
        type: string
      message:
        type: string
    type: object
  response.LoginResponse:
    properties:
      access_token:
        type: string
      access_token_expires_at:
        type: string
      refresh_token:
        type: string
      refresh_token_expires_at:
        type: string
      token_type:
        type: string
      user:
        $ref: '#/definitions/response.UserResponse'
    type: object
  response.MeResponse:
    properties:
      permissions:
        items:
          type: string
        type: array
      puskesmas:
        $ref: '#/definitions/response.PuskesmasResponse'
      user:
        $ref: '#/definitions/response.UserResponse'
    type: object
  response.Meta:
    properties:
      page:
        type: integer
      per_page:
        type: integer
      total:
        type: integer
      total_pages:
        type: integer
    type: object
  response.PuskesmasResponse:
    properties:
      accreditation:
        type: string
      address:
        type: string
      code:
        type: string
      email:
        type: string
      id:
        type: string
      name:
        type: string
      phone:
        type: string
      type:
        type: string
    type: object
  response.RefreshTokenResponse:
    properties:
      access_token:
        type: string
      access_token_expires_at:
        type: string
      refresh_token:
        type: string
      refresh_token_expires_at:
        type: string
      token_type:
        type: string
    type: object
  response.Response:
    properties:
      data: {}
      errors:
        items:
          $ref: '#/definitions/response.Error'
        type: array
      message:
        type: string
      meta:
        $ref: '#/definitions/response.Meta'
      success:
        type: boolean
    type: object
  response.RoleResponse:
    properties:
      code:
        type: string
      description:
        type: string
      id:
        type: string
      is_system:
        type: boolean
      name:
        type: string
    type: object
  response.UserListResponse:
    properties:
      page:
        type: integer
      per_page:
        type: integer
      total:
        type: integer
      total_pages:
        type: integer
      users:
        items:
          $ref: '#/definitions/response.UserResponse'
        type: array
    type: object
  response.UserResponse:
    properties:
      avatar_url:
        type: string
      created_at:
        type: string
      email:
        type: string
      full_name:
        type: string
      id:
        type: string
      last_login_at:
        type: string
      nik:
        type: string
      nip:
        type: string
      phone:
        type: string
      puskesmas_id:
        type: string
      roles:
        items:
          $ref: '#/definitions/response.RoleResponse'
        type: array
      sip_number:
        type: string
      specialization:
        type: string
      status:
        type: string
      str_number:
        type: string
      updated_at:
        type: string
      username:
        type: string
    type: object
host: localhost:8080
info:
  contact:
    email: support@simpus.local
    name: IT Support SIMPUS
    url: https://simpus.local/support
  description: Sistem Informasi Puskesmas (SIMPUS) - Enterprise Grade API
  license:
    name: Proprietary
    url: https://simpus.local/license
  termsOfService: https://simpus.local/terms/
  title: SIMPUS API
  version: 1.0.0
paths:
  /api/v1/auth/change-password:
    post:
      consumes:
      - application/json
      description: Change user's password
      parameters:
      - description: Password change request
        in: body
        name: request
        required: true
        schema:
          $ref: '#/definitions/request.ChangePasswordRequest'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/response.Response'
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/response.Response'
        "401":
          description: Unauthorized
          schema:
            $ref: '#/definitions/response.Response'
      security:
      - BearerAuth: []
      summary: Change Password
      tags:
      - Auth
  /api/v1/auth/forgot-password:
    post:
      consumes:
      - application/json
      description: Send password reset email
      parameters:
      - description: Email
        in: body
        name: request
        required: true
        schema:
          $ref: '#/definitions/request.ForgotPasswordRequest'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/response.Response'
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/response.Response'
      summary: Forgot Password
      tags:
      - Auth
  /api/v1/auth/login:
    post:
      consumes:
      - application/json
      description: Authenticate user and return JWT tokens
      parameters:
      - description: Login credentials
        in: body
        name: request
        required: true
        schema:
          $ref: '#/definitions/request.LoginRequest'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/response.LoginResponse'
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/response.Response'
        "401":
          description: Unauthorized
          schema:
            $ref: '#/definitions/response.Response'
      summary: User Login
      tags:
      - Auth
  /api/v1/auth/logout:
    post:
      consumes:
      - application/json
      description: Invalidate user tokens
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/response.Response'
        "401":
          description: Unauthorized
          schema:
            $ref: '#/definitions/response.Response'
      security:
      - BearerAuth: []
      summary: User Logout
      tags:
      - Auth
  /api/v1/auth/me:
    get:
      consumes:
      - application/json
      description: Get current authenticated user's details
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/response.MeResponse'
        "401":
          description: Unauthorized
          schema:
            $ref: '#/definitions/response.Response'
      security:
      - BearerAuth: []
      summary: Get Current User
      tags:
      - Auth
  /api/v1/auth/refresh:
    post:
      consumes:
      - application/json
      description: Generate new tokens using refresh token
      parameters:
      - description: Refresh token
        in: body
        name: request
        required: true
        schema:
          $ref: '#/definitions/request.RefreshTokenRequest'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/response.RefreshTokenResponse'
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/response.Response'
        "401":
          description: Unauthorized
          schema:
            $ref: '#/definitions/response.Response'
      summary: Refresh Token
      tags:
      - Auth
  /api/v1/auth/reset-password:
    post:
      consumes:
      - application/json
      description: Reset password using token from forgot password
      parameters:
      - description: Reset password
        in: body
        name: request
        required: true
        schema:
          $ref: '#/definitions/request.ResetPasswordRequest'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/response.Response'
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/response.Response'
        "401":
          description: Unauthorized
          schema:
            $ref: '#/definitions/response.Response'
      summary: Reset Password
      tags:
      - Auth
  /api/v1/users:
    get:
      consumes:
      - application/json
      description: Get a paginated list of users
      parameters:
      - default: 1
        description: Page number
        in: query
        name: page
        type: integer
      - default: 20
        description: Items per page
        in: query
        name: per_page
        type: integer
      - description: Search term
        in: query
        name: search
        type: string
      - description: Filter by status
        in: query
        name: status
        type: string
      - description: Filter by role ID
        in: query
        name: role_id
        type: string
      - description: Sort by field
        in: query
        name: sort_by
        type: string
      - description: Sort order (asc/desc)
        in: query
        name: sort_order
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/response.UserListResponse'
        "401":
          description: Unauthorized
          schema:
            $ref: '#/definitions/response.Response'
      security:
      - BearerAuth: []
      summary: List Users
      tags:
      - Users
    post:
      consumes:
      - application/json
      description: Create a new user
      parameters:
      - description: User data
        in: body
        name: request
        required: true
        schema:
          $ref: '#/definitions/request.CreateUserRequest'
      produces:
      - application/json
      responses:
        "201":
          description: Created
          schema:
            $ref: '#/definitions/response.UserResponse'
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/response.Response'
        "401":
          description: Unauthorized
          schema:
            $ref: '#/definitions/response.Response'
        "409":
          description: Conflict
          schema:
            $ref: '#/definitions/response.Response'
      security:
      - BearerAuth: []
      summary: Create User
      tags:
      - Users
  /api/v1/users/{id}:
    delete:
      consumes:
      - application/json
      description: Delete a user (soft delete)
      parameters:
      - description: User ID
        in: path
        name: id
        required: true
        type: string
      produces:
      - application/json
      responses:
        "204":
          description: No Content
        "401":
          description: Unauthorized
          schema:
            $ref: '#/definitions/response.Response'
        "404":
          description: Not Found
          schema:
            $ref: '#/definitions/response.Response'
      security:
      - BearerAuth: []
      summary: Delete User
      tags:
      - Users
    get:
      consumes:
      - application/json
      description: Get a user by ID
      parameters:
      - description: User ID
        in: path
        name: id
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/response.UserResponse'
        "401":
          description: Unauthorized
          schema:
            $ref: '#/definitions/response.Response'
        "404":
          description: Not Found
          schema:
            $ref: '#/definitions/response.Response'
      security:
      - BearerAuth: []
      summary: Get User
      tags:
      - Users
    put:
      consumes:
      - application/json
      description: Update an existing user
      parameters:
      - description: User ID
        in: path
        name: id
        required: true
        type: string
      - description: User data
        in: body
        name: request
        required: true
        schema:
          $ref: '#/definitions/request.UpdateUserRequest'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/response.UserResponse'
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/response.Response'
        "401":
          description: Unauthorized
          schema:
            $ref: '#/definitions/response.Response'
        "404":
          description: Not Found
          schema:
            $ref: '#/definitions/response.Response'
      security:
      - BearerAuth: []
      summary: Update User
      tags:
      - Users
  /health:
    get:
      consumes:
      - application/json
      description: Returns the health status of the API
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/health.HealthResponse'
      summary: Health Check
      tags:
      - Health
  /health/live:
    get:
      consumes:
      - application/json
      description: Returns if the service is alive
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/response.Response'
      summary: Liveness Probe
      tags:
      - Health
  /health/ready:
    get:
      consumes:
      - application/json
      description: Returns if the service is ready to accept traffic
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/response.Response'
        "503":
          description: Service Unavailable
          schema:
            $ref: '#/definitions/response.Response'
      summary: Readiness Probe
      tags:
      - Health
  /health/stats:
    get:
      consumes:
      - application/json
      description: Returns service statistics
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/response.Response'
      security:
      - BearerAuth: []
      summary: Service Stats
      tags:
      - Health
securityDefinitions:
  BearerAuth:
    description: Enter "Bearer {token}" to authenticate
    in: header
    name: Authorization
    type: apiKey
swagger: "2.0"
