openapi: 3.0.3
info:
  title: Info API - V1
  version: 1.0.0
  description: API for retrieving general and branding information of the portal.
  contact:
    name: SharinApp Team

servers:
  - url: https://api-staging.sharin.app
    description: Staging server (pre-production)
  - url: https://api.sharin.app
    description: Production server
  - url: http://api.sharinapp.local
    description: Local development server (used in tests)

security:
  - ApiKeyAuth: []

components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: API Key required for all requests

  schemas:
    SuccessResponse:
      type: object
      required: [meta, data]
      properties:
        data:
          type: object
          properties:
            info:
              allOf:
                - $ref: '#/components/schemas/Info'
            config:
              allOf:
                - $ref: '#/components/schemas/Config'
            branding:
              allOf:
                - $ref: '#/components/schemas/Branding'
            phone:
              type: array
              items:
                $ref: '#/components/schemas/Phone'
            email:
              type: array
              items:
                $ref: '#/components/schemas/Email'
            address:
              type: array
              items:
                $ref: '#/components/schemas/Address'
            social:
              type: array
              items:
                $ref: '#/components/schemas/Social'
        meta:
          allOf:
            - $ref: './schemas/CommonSchemas.yaml#/MetaDefaultResponse'
    Info:
      type: object
      properties:
        name:
          type: string
          example: SharinApp Marketplace
        title:
          type: string
          example: SharinApp - Your Trusted Marketplace
        description:
          type: string
          example: Discover the best sellers and deals on SharinApp.
        timezone:
          type: string
          example: Europe/Rome
      required: [name, title, description]


#    FeatureFlags:
#      type: object
#      properties:
#        multivendor:
#          type: boolean
#          example: true
#        guest_checkout:
#          type: boolean
#          example: false

    Config:
      type: object
      properties:
#        feature_flags:
#          $ref: '#/components/schemas/FeatureFlags'
        supported_languages:
          type: array
          items:
            type: string
          example: ["IT", "EN"]
        default_language:
          type: string
          example: IT
        supported_currencies:
          type: array
          items:
            type: string
          example: ["EUR", "USD"]
        default_currency:
          type: string
          example: EUR
      required: [supported_languages, default_language]

    Branding:
      type: object
      properties:
        logo:
          type: string
          format: uri
          example: https://cdn.sharinapp.com/assets/logo.svg
        logo_mobile:
          type: string
          format: uri
          example: https://cdn.sharinapp.com/assets/logo-mobile.svg
        image_set:
          type: object
          description: Map of attachment keys to URLs/paths
          additionalProperties:
            type: string
            format: uri
          example:
            header_logo: https://cdn.sharinapp.com/assets/logo.svg
            header_logo_mobile: https://cdn.sharinapp.com/assets/logo-mobile.svg
            favicon: https://cdn.sharinapp.com/assets/favicon.ico
      required: [logo, image_set]

    Social:
      type: object
      properties:
        platform:
          type: string
          description: Social network/platform name (e.g. Facebook, Instagram)
          example: facebook
        value:
          type: string
          description: URL or handle of the social profile
          example: https://facebook.com/sharinapp
      required: [platform, value]

    Phone:
      type: object
      properties:
        label:
          type: string
          description: User-friendly label
          example: Main
        value:
          type: string
          description: Phone number in international format
          example: +39 06 1234567
      required: [value]

    Email:
      type: object
      properties:
        label:
          type: string
          description: User-friendly label
          example: Customer Support
        value:
          type: string
          format: email
          description: Email address
          example: support@sharinapp.com
      required: [value]

    Address:
      type: object
      properties:
        label:
          type: string
          example: Headquarters
        street:
          type: string
          example: Via Roma 1
        city:
          type: string
          example: Rome
        zip:
          type: string
          example: 00100
        country:
          type: string
          example: Italy
      required: [street, city, zip, country]

    ErrorResponse:
      $ref: './schemas/CommonSchemas.yaml#/ErrorResponse'

paths:
  /v1/info:
    get:
      tags: [ Info ]
      summary: Retrieve general information, branding, configuration, etc.
      description: Returns information about the requested environment based on server and language.
      operationId: getInfo
      security:
        - ApiKeyAuth: []
      parameters:
        - $ref: './schemas/CommonSchemas.yaml#/ServerParamHeader'
        - $ref: './schemas/CommonSchemas.yaml#/LangParamHeader'
      responses:
        '200':
          description: Environment information
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse'
        default:
          description: Request error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
