openapi: 3.0.3
info:
  title: Refererentials
  description: Refererentials
  version: 1.0.0
servers:
  - url: https://api.autopass.pro
    description: Live server
    x-environment: live
  - url: https://api-prelive.autopass.pro
    description: Prelive server
    x-environment: prelive
paths:
  /referential/family-groups:
    get:
      tags:
        - family-groups
      description: List family groups.
      summary: List family groups
      operationId: list-family-groups
      responses:
        200:
          description: Successful list groups of families
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FamilyGroupsCollection"
  /referential/family-groups/{family_group_id}:
    get:
      tags:
        - family-groups
      description: Get a family group by its ID.
      summary: Get a family group
      operationId: get-family-group
      parameters:
        - in: path
          schema:
            type: integer
          name: family_group_id
          required: true
      responses:
        200:
          description: Sucessful got family group
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FamilyGroup"
  /referential/families:
    get:
      tags:
        - families
      description: List families.
      summary: List families
      operationId: list-families
      responses:
        200:
          description: Sucessful list families
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FamiliesCollection"
  /referential/families/{family_id}:
    get:
      tags:
        - families
      description: Get a family by its ID.
      summary: Get a family
      operationId: get-family
      parameters:
        - in: path
          schema:
            type: integer
          name: family_id
          required: true
      responses:
        200:
          description: Sucessful got family
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FamilyDetail"

  /referential/positions:
    get:
      tags:
        - positions
      description: List positions.
      summary: List positions
      operationId: list-positions
      responses:
        200:
          description: Sucessful list positions
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PositionsCollection"
  /referential/positions/{position_id}:
    get:
      tags:
        - positions
      description: Get a position by its ID.
      summary: Get a position
      operationId: get-position
      parameters:
        - in: path
          schema:
            type: integer
          name: position_id
          required: true
      responses:
        200:
          description: Sucessful got position
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Position"
  /referential/providers:
    get:
      tags:
        - providers
      description: List providers.
      summary: List providers
      operationId: list-providers
      responses:
        200:
          description: Sucessful list providers
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProvidersCollection"
  /referential/accounts:
    get:
      tags:
        - accounts
      description: List accounts.
      summary: List accounts
      operationId: list-accounts
      responses:
        200:
          description: Sucessful list accounts
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountsCollection"
  /referential/applications:
    get:
      tags:
        - applications
      description: List applications.
      summary: List applications
      operationId: list-applications
      parameters:
        - in: query
          schema:
            type: string
          name: name
          description: Filters on name.
        - in: query
          schema:
            type: integer
          name: ktypnr
          description: Filters on ktype ID.
      responses:
        200:
          description: Sucessful list applications
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApplicationsCollection"
  /referential/applications/{application_id}:
    get:
      tags:
        - applications
      description: Get an application by its ID.
      summary: Get an application
      operationId: get-application
      parameters:
        - in: path
          schema:
            type: integer
          name: application_id
          required: true
      responses:
        200:
          description: Sucessful got application
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Application"
  /referential/energies:
    get:
      tags:
        - energies
      description: List energies.
      summary: List energies
      operationId: list-energies
      responses:
        200:
          description: Sucessful list energies
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EnergiesCollection"
  /referential/energies/{energy_id}:
    get:
      tags:
        - energies
      description: Get an energy by its ID.
      summary: Get an energy
      operationId: get-energy
      parameters:
        - in: path
          schema:
            type: integer
          name: energy_id
          required: true
      responses:
        200:
          description: Sucessful got energy
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Energy"
  /referential/categories:
    get:
      tags:
        - categories
      description: List (vehicle) categories.
      summary: List categories
      operationId: list-categories
      responses:
        200:
          description: Sucessful list categories
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CategoriesCollection"
  /referential/categories/{category_id}:
    get:
      tags:
        - categories
      description: Get a category by its ID.
      summary: Get a category
      operationId: get-category
      parameters:
        - in: path
          schema:
            type: integer
          name: category_id
          required: true
      responses:
        200:
          description: Sucessful got category
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Category"
  /referential/colors:
    get:
      tags:
        - colors
      description: List (vehicle) colors.
      summary: List colors
      operationId: list-colors
      responses:
        200:
          description: Sucessful list colors
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ColorsCollection"
  /referential/colors/{color_id}:
    get:
      tags:
        - colors
      description: Get a color by its ID.
      summary: Get a color
      operationId: get-color
      parameters:
        - in: path
          schema:
            type: integer
          name: color_id
          required: true
      responses:
        200:
          description: Sucessful got color
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Color"
  /referential/gearboxes:
    get:
      tags:
        - gearboxes
      description: List gearboxes.
      summary: List gearboxes
      operationId: list-gearboxes
      responses:
        200:
          description: Sucessful list gearboxes
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GearboxesCollection"
  /referential/gearboxes/{gearbox_id}:
    get:
      tags:
        - gearboxes
      description: Get a gearbox by its ID.
      summary: Get a gearbox
      operationId: get-gearbox
      parameters:
        - in: path
          schema:
            type: integer
          name: gearbox_id
          required: true
      responses:
        200:
          description: Sucessful got gearbox
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Gearbox"
  /referential/air-quality-norms:
    get:
      tags:
        - air-quality-norms
      description: List (vehicle) air quality norms.
      summary: List air quality norms
      operationId: list-air-quality-norms
      responses:
        200:
          description: Sucessful list air quality norms
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AirQualityNormsCollection"
  /referential/air-quality-norms/{air_quality_norm_id}:
    get:
      tags:
        - air-quality-norms
      description: Get an air quality norm by its ID.
      summary: Get an air quality norm
      operationId: get-air-quality-norm
      parameters:
        - in: path
          schema:
            type: integer
          name: air_quality_norm_id
          required: true
      responses:
        200:
          description: Sucessful got air quality norm
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AirQualityNorm"
  /referential/euro-norms:
    get:
      tags:
        - euro-norms
      description: List (vehicle) euro norms.
      summary: List euro norms
      operationId: list-euro-norms
      responses:
        200:
          description: Sucessful list euro norms
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EuroNormsCollection"
  /referential/euro-norms/{euro_norm_id}:
    get:
      tags:
        - euro-norms
      description: Get an euro norm by its ID.
      summary: Get an euro norm
      operationId: get-euro-norms
      parameters:
        - in: path
          schema:
            type: integer
          name: euro_norm_id
          required: true
      responses:
        200:
          description: Sucessful got euro norm
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EuroNorm"
  /referential/takata-ktypnrs:
    get:
      tags:
        - takata-ktypnrs
      description: List KTypnrs relative to Takata airbags recall.
      summary: List Takata KTypnrs
      operationId: list-takata-ktypnrs
      parameters:
        - in: query
          name: ktypnrs
          description: comma-separated (vehicle) ktypnrs
          example: 6030,1,2
          schema:
            type: string
          required: false
        - in: query
          name: date
          description: (vehicle) date
          example: 2006-12-31
          schema:
            type: string
          required: false
      responses:
        200:
          description: OK.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TakataKtypnrCollection"
        400:
          description: Bad request.
        404:
          description: Not found.
security:
  - ApiKeyAuth: []
  - ApiKeyHeader: []
  - ApiKeyQuery: []
  - BearerAuth: []
components:
  securitySchemes:
    ApiKeyQuery:
      type: apiKey
      in: query
      name: access_token
    ApiKeyHeader:
      type: apiKey
      in: header
      name: X-Access-Token
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    Meta:
      type: object
      properties:
        limit:
          type: integer
          example: 100
        offset:
          type: integer
          example: 20
        total:
          type: integer
          example: 200
    FamilyGroupsCollection:
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/Meta"
        family_groups:
          $ref: "#/components/schemas/FamilyGroups"
    FamiliesCollection:
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/Meta"
        families:
          $ref: "#/components/schemas/Families"
    EnergiesCollection:
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/Meta"
        energies:
          $ref: "#/components/schemas/Energies"
    CategoriesCollection:
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/Meta"
        categories:
          $ref: "#/components/schemas/Categories"
    ColorsCollection:
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/Meta"
        colors:
          $ref: "#/components/schemas/Colors"
    AirQualityNormsCollection:
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/Meta"
        air_quality_norms:
          $ref: "#/components/schemas/AirQualityNorms"
    EuroNormsCollection:
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/Meta"
        euro_norms:
          $ref: "#/components/schemas/EuroNorms"
    GearboxesCollection:
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/Meta"
        gearboxes:
          $ref: "#/components/schemas/Gearboxes"
    PositionsCollection:
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/Meta"
        positions:
          $ref: "#/components/schemas/Positions"
    ProvidersCollection:
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/Meta"
        providers:
          $ref: "#/components/schemas/Providers"
    AccountsCollection:
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/Meta"
        accounts:
          $ref: "#/components/schemas/Accounts"
    ApplicationsCollection:
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/Meta"
        applications:
          $ref: "#/components/schemas/Applications"
    TakataKtypnrCollection:
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/Meta"
        ktypnrs:
          $ref: "#/components/schemas/TakataKtypnrs"
    FamilyGroups:
      type: array
      items:
        type: object
        $ref: "#/components/schemas/FamilyGroup"
    FamilyGroup:
      type: object
      properties:
        group_id:
          type: number
          example: 1
        label:
          type: string
          example: "Freinage"
        families:
          $ref: "#/components/schemas/FamilyGroupFamilies"
    Families:
      type: array
      items:
        type: object
        $ref: "#/components/schemas/Family"
    Energies:
      type: array
      items:
        type: object
        $ref: "#/components/schemas/Energy"
    Categories:
      type: array
      items:
        type: object
        $ref: "#/components/schemas/Category"
    Colors:
      type: array
      items:
        type: object
        $ref: "#/components/schemas/Color"
    AirQualityNorms:
      type: array
      items:
        type: object
        $ref: "#/components/schemas/AirQualityNorm"
    EuroNorms:
      type: array
      items:
        type: object
        $ref: "#/components/schemas/EuroNorm"
    Gearboxes:
      type: array
      items:
        type: object
        $ref: "#/components/schemas/Gearbox"
    Positions:
      type: array
      items:
        type: object
        $ref: "#/components/schemas/Position"
    Providers:
      type: array
      items:
        type: object
        $ref: "#/components/schemas/Provider"
    Accounts:
      type: array
      items:
        type: object
        $ref: "#/components/schemas/Account"
    Applications:
      type: array
      items:
        type: object
        $ref: "#/components/schemas/Application"
    TakataKtypnrs:
      type: array
      items:
        type: object
        $ref: "#/components/schemas/TakataKtypnr"
    FamilyGroupFamilies:
      type: array
      items:
        type: object
        $ref: "#/components/schemas/FamilyGroupFamily"
    Energy:
      properties:
        energy_id:
          type: number
          example: 1
        label:
          type: string
          example: "Diesel"
    Category:
      properties:
        category_id:
          type: number
          example: 1
        label:
          type: string
          example: "VASP"
        description:
          type: string
          example: "Véhicule de tourisme"
    EuroNorm:
      properties:
        euro_norm_id:
          type: number
          example: 1
        label:
          type: string
          example: "Euro 1"
        description:
          type: string
          example: "Véhicule de tourisme"
    AirQualityNorm:
      properties:
        air_quality_norm_id:
          type: number
          example: 1
        label:
          type: string
          example: "E"
    Color:
      properties:
        color_id:
          type: number
          example: 1
        label:
          type: string
          example: "NOIR"
    Gearbox:
      properties:
        gearbox_id:
          type: number
          example: 1
        label:
          type: string
          example: "Manuelle"
    Position:
      properties:
        position_id:
          type: number
          example: 1
        label:
          type: string
          example: "AV INF D"
        description:
          type: string
          example: "Avant Inférieur Droit"
    FamilyGroupFamily:
      properties:
        family_id:
          type: number
          example: 1
        label:
          type: string
          example: "Plaquette de frein"
    Family:
      properties:
        group:
          type: object
          properties:
            group_id:
              type: number
              example: 1
            label:
              type: string
              example: "Freinage"
        family_id:
          type: number
          example: 1
        label:
          type: string
          example: "Plaquette de frein"
        links:
          $ref: "#/components/schemas/FamilyLinks"
    FamilyDetail:
      allOf:
        - $ref: "#/components/schemas/Family"
        - type: object
          properties:
            applications:
              type: array
              items:
                $ref: "#/components/schemas/FamilyApplication"
    FamilyLinks:
      type: object
      properties:
        family_group:
          type: string
          example: https://api.autopass.pro/family_groups/1
    FamilyGroupLinks:
      type: object
      properties:
        families:
          type: string
          example: https://api.autopass.pro/family_groups/1/families
    FamilyApplication:
      type: object
      properties:
        application_id:
          type: integer
          example: 1
        position_id:
          type: integer
          example: 1
        links:
          type: object
          properties:
            application:
              type: string
              example: https://api.autopass.pro/applications/1
            position:
              type: string
              example: https://api.autopass.pro/positions/1
    Provider:
      properties:
        provider_id:
          type: number
          example: 1
        name:
          type: string
          example: "TE"
        description:
          type: string
          example: "TecDoc"
        type:
          type: string
          enum:
            [
              "vis",
              "manufacturer",
              "equip",
              "other",
              "tecdoc",
              "tech_information",
              "internal",
            ]
          example: "vis"
        is_active:
          type: boolean
          example: true
    Account:
      properties:
        account_id:
          type: number
          example: 1
        account_type_name:
          type: string
          example: "norauto"
        account_type_id:
          type: number
          example: 1
        account_type_label:
          type: string
          example: "norauto-garagiste"
    Application:
      properties:
        application_id:
          type: number
          example: 1
        family:
          type: object
          properties:
            family_id:
              type: number
              example: 1
            label:
              type: string
              example: "Frein"
        position:
          type: object
          properties:
            position_id:
              type: number
              example: 1
            label:
              type: string
              example: "AV D/G"
        links:
          $ref: "#/components/schemas/ApplicationLinks"
    ApplicationLinks:
      type: object
      properties:
        family:
          type: string
          example: https://api.autopass.pro/families/1
        position:
          type: string
          example: https://api.autopass.pro/positions/1
    TakataKtypnr:
      properties:
        ktypnr:
          type: number
          example: 6030
        date_from:
          type: string
          example: 2006-01-31
        date_to:
          type: string
          example: 2006-01-31
        links:
          $ref: "#/components/schemas/TakataKtypnrLinks"
    TakataKtypnrLinks:
      type: object
      properties:
        self:
          type: string
          example: https://api.autopass.pro/car-selectors/tecdoc/ktypes/6030
        recall:
          type: string
          example: https://www.audi.fr/fr/campagne-rappel-airbag-takata/?de
