openapi: 3.0.3
info:
  title: Parts Management Provisioning API
  description: API endpoint to provision a new shop and user in the Parts Management system.
  version: 1.0.0

paths:
  /parts-management/provision:
    post:
      summary: Provision a new parts management shop and user
      operationId: partsManagementProvisioning
      tags:
        - Parts Management
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - external_shop_id
                - shopname
                - address1
                - city
                - state
                - zip_post
                - country
                - email
                - phone
                - userEmail
              properties:
                external_shop_id:
                  type: string
                  description: External shop ID (must be unique)
                shopname:
                  type: string
                address1:
                  type: string
                address2:
                  type: string
                  nullable: true
                city:
                  type: string
                state:
                  type: string
                zip_post:
                  type: string
                country:
                  type: string
                email:
                  type: string
                phone:
                  type: string
                userEmail:
                  type: string
                  format: email
                userPassword:
                  type: string
                  description: Optional password for the new user. If provided, the password is set directly, and no password reset link is sent. Must be at least 6 characters.
                  nullable: true
                logoUrl:
                  type: string
                  format: uri
                  nullable: true
                timezone:
                  type: string
                  nullable: true
                vendors:
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                      street1:
                        type: string
                        nullable: true
                      street2:
                        type: string
                        nullable: true
                      city:
                        type: string
                        nullable: true
                      state:
                        type: string
                        nullable: true
                      zip:
                        type: string
                        nullable: true
                      country:
                        type: string
                        nullable: true
                      email:
                        type: string
                        format: email
                        nullable: true
                      discount:
                        type: number
                        nullable: true
                      due_date:
                        type: string
                        format: date
                        nullable: true
                      cost_center:
                        type: string
                        nullable: true
                      favorite:
                        type: array
                        items:
                          type: string
                        nullable: true
                      phone:
                        type: string
                        nullable: true
                      active:
                        type: boolean
                        nullable: true
                      dmsid:
                        type: string
                        nullable: true
      responses:
        '200':
          description: Shop and user successfully created
          content:
            application/json:
              schema:
                type: object
                properties:
                  shop:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                      shopname:
                        type: string
                  user:
                    type: object
                    properties:
                      id:
                        type: string
                      email:
                        type: string
                      resetLink:
                        type: string
                        format: uri
                        nullable: true
                        description: Password reset link for the user. Only included if userPassword is not provided in the request.
        '400':
          description: Bad request (missing or invalid fields)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
