openapi: 3.0.3
info:
  title: Flicknexs API
  version: 0.1.0
  description: |
    Initial OpenAPI spec capturing key routers and representative endpoints.
    This is a starter; expand with additional endpoints as needed.
servers:
  - url: http://localhost:7006
    description: Local development
  - url: https://api.example.com
    description: Production (update to your actual BASE_URL)
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    GenericResponse:
      type: object
      properties:
        status:
          type: boolean
        message:
          type: string
    UploadResponse:
      type: object
      properties:
        status:
          type: boolean
        id:
          type: string
        url:
          type: string
    LoginRequest:
      type: object
      properties:
        email:
          type: string
          format: email
        password:
          type: string
      required: [email, password]
    SignupRequest:
      type: object
      properties:
        name:
          type: string
        email:
          type: string
          format: email
        password:
          type: string
      required: [name, email, password]
    IdPath:
      type: object
      properties:
        id:
          type: string

security:
  - bearerAuth: []

tags:
  - name: Root
  - name: AdminVideo
  - name: Partner
  - name: Advertiser
  - name: FrontEnd
  - name: MultiProfile
  - name: TVLogin
  - name: Static

paths:
  # Root
  /:
    get:
      tags: [Root]
      summary: Health / Welcome
      responses:
        '200':
          description: Welcome message
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  node_version:
                    type: string

  # Static mounts (documented as info only; served as static assets)
  /uploads:
    get:
      tags: [Static]
      summary: Static file server for uploads (images, videos, etc.)
      responses:
        '200':
          description: Serves files
  /images:
    get:
      tags: [Static]
      summary: Static file server for images
      responses:
        '200':
          description: Serves files

  # Admin videos
  /admin/videos/upload:
    post:
      tags: [AdminVideo]
      summary: Upload video(s) and enqueue transcoding
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                videos:
                  type: array
                  items:
                    type: string
                    format: binary
      responses:
        '200':
          description: Upload accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadResponse'

  # Partner
  /partner/signup:
    post:
      tags: [Partner]
      summary: Partner signup
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SignupRequest'
      responses:
        '200':
          description: Signup result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericResponse'
  /partner/signin:
    post:
      tags: [Partner]
      summary: Partner sign-in
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoginRequest'
      responses:
        '200':
          description: Login result
          content:
            application/json:
              schema:
                type: object
                properties:
                  token:
                    type: string
  /partner/uploadProfileImage:
    post:
      tags: [Partner]
      summary: Upload partner profile image
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                avatar:
                  type: string
                  format: binary
      responses:
        '200':
          description: Uploaded
  /partner/uploadIntroVideo:
    post:
      tags: [Partner]
      summary: Upload partner intro video
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                intro_video:
                  type: string
                  format: binary
      responses:
        '200':
          description: Uploaded
  /partner/logout:
    get:
      tags: [Partner]
      summary: Partner logout
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Logged out

  # Advertiser
  /advertiser/login:
    post:
      tags: [Advertiser]
      summary: Advertiser login
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoginRequest'
      responses:
        '200':
          description: Login result
  /advertiser/signup:
    post:
      tags: [Advertiser]
      summary: Advertiser signup
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SignupRequest'
      responses:
        '200':
          description: Signup result
  /advertiser/account-detail:
    get:
      tags: [Advertiser]
      summary: Get advertiser account detail
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Account detail
  /advertiser/advertisement:
    get:
      tags: [Advertiser]
      summary: List advertisements
      security:
        - bearerAuth: []
      responses:
        '200':
          description: List
    post:
      tags: [Advertiser]
      summary: Create advertisement
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '200':
          description: Created
  /advertiser/advertisement-edit/{id}:
    get:
      tags: [Advertiser]
      summary: Get advertisement by id
      security:
        - bearerAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK

  # Front-End (representative subset)
  /Front-End/user-details:
    get:
      tags: [FrontEnd]
      summary: Get current user details
      security:
        - bearerAuth: []
      responses:
        '200':
          description: User details
  /Front-End/subscription-plans:
    get:
      tags: [FrontEnd]
      summary: Get subscription plans
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Plans
  /Front-End/video-details:
    post:
      tags: [FrontEnd]
      summary: Get video details
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                video_id:
                  type: string
      responses:
        '200':
          description: Details
  /Front-End/Watchlater-Update:
    post:
      tags: [FrontEnd]
      summary: Update watchlater
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '200':
          description: OK

  # Multi-Profile
  /Multi-Profile/index:
    get:
      tags: [MultiProfile]
      summary: List profiles
      security:
        - bearerAuth: []
      responses:
        '200':
          description: OK
  /Multi-Profile/store:
    post:
      tags: [MultiProfile]
      summary: Create profile
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                image:
                  type: string
                  format: binary
      responses:
        '200':
          description: Created
  /Multi-Profile/edit/{sub_user_id}:
    get:
      tags: [MultiProfile]
      summary: Get profile
      security:
        - bearerAuth: []
      parameters:
        - in: path
          name: sub_user_id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
  /Multi-Profile/update:
    post:
      tags: [MultiProfile]
      summary: Update profile
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                image:
                  type: string
                  format: binary
      responses:
        '200':
          description: Updated
  /Multi-Profile/delete/{sub_user_id}:
    delete:
      tags: [MultiProfile]
      summary: Delete profile
      security:
        - bearerAuth: []
      parameters:
        - in: path
          name: sub_user_id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Deleted

  # TV Login
  /tv-login/tv-display-code:
    get:
      tags: [TVLogin]
      summary: Get TV display code
      responses:
        '200':
          description: Code
  /tv-login/tv-code-signin:
    post:
      tags: [TVLogin]
      summary: Sign in via TV code
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '200':
          description: OK
  /tv-login/tv-verify-code:
    post:
      tags: [TVLogin]
      summary: Verify TV activation code
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '200':
          description: OK

