- table:
    name: allocations
    schema: public
  object_relationships:
    - name: employee
      using:
        foreign_key_constraint_on: employeeid
    - name: jobline
      using:
        foreign_key_constraint_on: joblineid
  insert_permissions:
    - role: user
      permission:
        check:
          jobline:
            job:
              bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
        columns:
          - hours
          - created_at
          - updated_at
          - employeeid
          - id
          - joblineid
  select_permissions:
    - role: user
      permission:
        columns:
          - hours
          - created_at
          - updated_at
          - employeeid
          - id
          - joblineid
        filter:
          jobline:
            job:
              bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
  update_permissions:
    - role: user
      permission:
        columns: []
        filter:
          jobline:
            job:
              bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          jobline:
            job:
              bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
- table:
    name: appointments
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
    - name: job
      using:
        foreign_key_constraint_on: jobid
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - arrived
          - block
          - bodyshopid
          - canceled
          - color
          - created_at
          - created_by
          - end
          - id
          - isintake
          - jobid
          - note
          - start
          - title
          - updated_at
  select_permissions:
    - role: user
      permission:
        columns:
          - arrived
          - block
          - bodyshopid
          - canceled
          - color
          - created_at
          - created_by
          - end
          - id
          - isintake
          - jobid
          - note
          - start
          - title
          - updated_at
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - arrived
          - block
          - bodyshopid
          - canceled
          - color
          - created_at
          - created_by
          - end
          - id
          - isintake
          - jobid
          - note
          - start
          - title
          - updated_at
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
- table:
    name: associations
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: shopid
    - name: user
      using:
        foreign_key_constraint_on: useremail
  select_permissions:
    - role: user
      permission:
        columns:
          - active
          - authlevel
          - default_prod_list_view
          - id
          - kanban_settings
          - qbo_realmId
          - shopid
          - useremail
        filter:
          user:
            authid:
              _eq: X-Hasura-User-Id
  update_permissions:
    - role: user
      permission:
        columns:
          - active
          - authlevel
          - default_prod_list_view
          - kanban_settings
          - qbo_realmId
        filter:
          user:
            authid:
              _eq: X-Hasura-User-Id
        check: null
- table:
    name: audit_trail
    schema: public
  object_relationships:
    - name: bill
      using:
        foreign_key_constraint_on: billid
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
    - name: job
      using:
        foreign_key_constraint_on: jobid
    - name: user
      using:
        foreign_key_constraint_on: useremail
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - billid
          - bodyshopid
          - created
          - id
          - jobid
          - new_val
          - old_val
          - operation
          - type
          - useremail
  select_permissions:
    - role: user
      permission:
        columns:
          - billid
          - bodyshopid
          - created
          - id
          - jobid
          - new_val
          - old_val
          - operation
          - type
          - useremail
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
- table:
    name: available_jobs
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
    - name: job
      using:
        foreign_key_constraint_on: jobid
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - bodyshopid
          - cieca_id
          - clm_amt
          - clm_no
          - created_at
          - est_data
          - id
          - ins_co_nm
          - issupplement
          - jobid
          - ownr_name
          - source_system
          - supplement_number
          - updated_at
          - uploaded_by
          - vehicle_info
  select_permissions:
    - role: user
      permission:
        columns:
          - bodyshopid
          - cieca_id
          - clm_amt
          - clm_no
          - created_at
          - est_data
          - id
          - ins_co_nm
          - issupplement
          - jobid
          - ownr_name
          - source_system
          - supplement_number
          - updated_at
          - uploaded_by
          - vehicle_info
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
  update_permissions:
    - role: user
      permission:
        columns:
          - cieca_id
          - clm_amt
          - est_data
          - ins_co_nm
          - issupplement
          - ownr_name
          - source_system
          - supplement_number
          - uploaded_by
          - vehicle_info
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
- table:
    name: billlines
    schema: public
  object_relationships:
    - name: bill
      using:
        foreign_key_constraint_on: billid
    - name: jobline
      using:
        foreign_key_constraint_on: joblineid
  array_relationships:
    - name: inventories
      using:
        foreign_key_constraint_on:
          column: billlineid
          table:
            name: inventory
            schema: public
  insert_permissions:
    - role: user
      permission:
        check:
          bill:
            job:
              bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
        columns:
          - actual_cost
          - actual_price
          - applicable_taxes
          - billid
          - cost_center
          - created_at
          - deductedfromlbr
          - id
          - joblineid
          - lbr_adjustment
          - line_desc
          - quantity
          - updated_at
  select_permissions:
    - role: user
      permission:
        columns:
          - actual_cost
          - actual_price
          - applicable_taxes
          - billid
          - cost_center
          - created_at
          - deductedfromlbr
          - id
          - joblineid
          - lbr_adjustment
          - line_desc
          - quantity
          - updated_at
        filter:
          bill:
            job:
              bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - actual_cost
          - actual_price
          - applicable_taxes
          - billid
          - cost_center
          - created_at
          - deductedfromlbr
          - id
          - joblineid
          - lbr_adjustment
          - line_desc
          - quantity
          - updated_at
        filter:
          bill:
            job:
              bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          bill:
            job:
              bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
- table:
    name: bills
    schema: public
  object_relationships:
    - name: job
      using:
        foreign_key_constraint_on: jobid
    - name: vendor
      using:
        foreign_key_constraint_on: vendorid
  array_relationships:
    - name: audit_trails
      using:
        foreign_key_constraint_on:
          column: billid
          table:
            name: audit_trail
            schema: public
    - name: billlines
      using:
        foreign_key_constraint_on:
          column: billid
          table:
            name: billlines
            schema: public
    - name: documents
      using:
        foreign_key_constraint_on:
          column: billid
          table:
            name: documents
            schema: public
    - name: exportlogs
      using:
        foreign_key_constraint_on:
          column: billid
          table:
            name: exportlog
            schema: public
    - name: inventories
      using:
        foreign_key_constraint_on:
          column: consumedbybillid
          table:
            name: inventory
            schema: public
    - name: parts_orders
      using:
        foreign_key_constraint_on:
          column: returnfrombill
          table:
            name: parts_orders
            schema: public
    - name: tasks
      using:
        foreign_key_constraint_on:
          column: billid
          table:
            name: tasks
            schema: public
  insert_permissions:
    - role: user
      permission:
        check:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        columns:
          - created_at
          - date
          - due_date
          - exported
          - exported_at
          - federal_tax_rate
          - id
          - invoice_number
          - is_credit_memo
          - isinhouse
          - jobid
          - local_tax_rate
          - state_tax_rate
          - total
          - updated_at
          - vendorid
  select_permissions:
    - role: user
      permission:
        columns:
          - created_at
          - date
          - due_date
          - exported
          - exported_at
          - federal_tax_rate
          - id
          - invoice_number
          - is_credit_memo
          - isinhouse
          - jobid
          - local_tax_rate
          - state_tax_rate
          - total
          - updated_at
          - vendorid
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - created_at
          - date
          - due_date
          - exported
          - exported_at
          - federal_tax_rate
          - id
          - invoice_number
          - is_credit_memo
          - isinhouse
          - jobid
          - local_tax_rate
          - state_tax_rate
          - total
          - updated_at
          - vendorid
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          _and:
            - job:
                bodyshop:
                  associations:
                    _and:
                      - user:
                          authid:
                            _eq: X-Hasura-User-Id
                      - active:
                          _eq: true
            - exported:
                _eq: false
  event_triggers:
    - name: os_bills
      definition:
        delete:
          columns: '*'
        enable_manual: false
        insert:
          columns: '*'
        update:
          columns: '*'
      retry_conf:
        interval_sec: 10
        num_retries: 3
        timeout_sec: 60
      webhook_from_env: HASURA_API_URL
      headers:
        - name: event-secret
          value_from_env: EVENT_SECRET
      request_transform:
        method: POST
        query_params: {}
        template_engine: Kriti
        url: '{{$base_url}}/opensearch'
        version: 2
- table:
    name: bodyshops
    schema: public
  array_relationships:
    - name: appointments
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: appointments
            schema: public
    - name: associations
      using:
        foreign_key_constraint_on:
          column: shopid
          table:
            name: associations
            schema: public
    - name: audit_trails
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: audit_trail
            schema: public
    - name: available_jobs
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: available_jobs
            schema: public
    - name: conversations
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: conversations
            schema: public
    - name: counters
      using:
        foreign_key_constraint_on:
          column: shopid
          table:
            name: counters
            schema: public
    - name: courtesycars
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: courtesycars
            schema: public
    - name: csiinvites
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: csi
            schema: public
    - name: csiquestions
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: csiquestions
            schema: public
    - name: dms_vehicles
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: dms_vehicles
            schema: public
    - name: documents
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: documents
            schema: public
    - name: email_audit_trails
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: email_audit_trail
            schema: public
    - name: employee_teams
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: employee_teams
            schema: public
    - name: employees
      using:
        foreign_key_constraint_on:
          column: shopid
          table:
            name: employees
            schema: public
    - name: exportlogs
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: exportlog
            schema: public
    - name: inventories
      using:
        foreign_key_constraint_on:
          column: shopid
          table:
            name: inventory
            schema: public
    - name: ioevents
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: ioevents
            schema: public
    - name: jobs
      using:
        foreign_key_constraint_on:
          column: shopid
          table:
            name: jobs
            schema: public
    - name: owners
      using:
        foreign_key_constraint_on:
          column: shopid
          table:
            name: owners
            schema: public
    - name: payment_responses
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: payment_response
            schema: public
    - name: phonebooks
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: phonebook
            schema: public
    - name: tasks
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: tasks
            schema: public
    - name: timetickets
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: timetickets
            schema: public
    - name: transitions
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: transitions
            schema: public
    - name: tt_approval_queues
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: tt_approval_queue
            schema: public
    - name: vehicles
      using:
        foreign_key_constraint_on:
          column: shopid
          table:
            name: vehicles
            schema: public
    - name: vendors
      using:
        foreign_key_constraint_on:
          column: bodyshopid
          table:
            name: vendors
            schema: public
  select_permissions:
    - role: user
      permission:
        columns:
          - accountingconfig
          - address1
          - address2
          - appt_alt_transport
          - appt_colors
          - appt_length
          - attach_pdf_to_email
          - autohouseid
          - bill_allow_post_to_closed
          - bill_tax_rates
          - cdk_configuration
          - cdk_dealerid
          - city
          - claimscorpid
          - convenient_company
          - country
          - created_at
          - default_adjustment_rate
          - deliverchecklist
          - email
          - enforce_class
          - enforce_conversion_category
          - enforce_conversion_csr
          - enforce_referral
          - entegral_configuration
          - entegral_id
          - features
          - federal_tax_id
          - id
          - imexshopid
          - inhousevendorid
          - insurance_vendor_id
          - intakechecklist
          - jc_hourly_rates
          - jobsizelimit
          - last_name_first
          - localmediaserverhttp
          - localmediaservernetwork
          - localmediatoken
          - logo_img_path
          - md_categories
          - md_ccc_rates
          - md_classes
          - md_ded_notes
          - md_email_cc
          - md_estimators
          - md_filehandlers
          - md_from_emails
          - md_functionality_toggles
          - md_hour_split
          - md_ins_cos
          - md_jobline_presets
          - md_labor_rates
          - md_lost_sale_reasons
          - md_messaging_presets
          - md_notes_presets
          - md_order_statuses
          - md_parts_locations
          - md_parts_order_comment
          - md_parts_scan
          - md_payment_types
          - md_rbac
          - md_referral_sources
          - md_responsibility_centers
          - md_ro_guard
          - md_ro_statuses
          - md_tasks_presets
          - md_to_emails
          - messagingservicesid
          - pbs_configuration
          - pbs_serialnumber
          - phone
          - prodtargethrs
          - production_config
          - region_config
          - schedule_end_time
          - schedule_start_time
          - scoreboard_target
          - shopname
          - shoprates
          - speedprint
          - ss_configuration
          - ssbuckets
          - state
          - state_tax_id
          - stripe_acct_id
          - sub_status
          - target_touchtime
          - template_header
          - textid
          - timezone
          - tt_allow_post_to_invoiced
          - tt_enforce_hours_for_tech_console
          - updated_at
          - use_fippa
          - use_paint_scale_data
          - uselocalmediaserver
          - website
          - workingdays
          - zip_post
        filter:
          associations:
            user:
              authid:
                _eq: X-Hasura-User-Id
  update_permissions:
    - role: user
      permission:
        columns:
          - accountingconfig
          - address1
          - address2
          - appt_alt_transport
          - appt_colors
          - appt_length
          - attach_pdf_to_email
          - bill_allow_post_to_closed
          - bill_tax_rates
          - cdk_configuration
          - city
          - country
          - created_at
          - default_adjustment_rate
          - deliverchecklist
          - email
          - enforce_class
          - enforce_conversion_category
          - enforce_conversion_csr
          - enforce_referral
          - federal_tax_id
          - id
          - inhousevendorid
          - insurance_vendor_id
          - intakechecklist
          - jc_hourly_rates
          - last_name_first
          - localmediaserverhttp
          - localmediaservernetwork
          - localmediatoken
          - logo_img_path
          - md_categories
          - md_ccc_rates
          - md_classes
          - md_ded_notes
          - md_email_cc
          - md_estimators
          - md_filehandlers
          - md_from_emails
          - md_functionality_toggles
          - md_hour_split
          - md_ins_cos
          - md_jobline_presets
          - md_labor_rates
          - md_lost_sale_reasons
          - md_messaging_presets
          - md_notes_presets
          - md_order_statuses
          - md_parts_locations
          - md_parts_order_comment
          - md_parts_scan
          - md_payment_types
          - md_rbac
          - md_referral_sources
          - md_responsibility_centers
          - md_ro_guard
          - md_ro_statuses
          - md_tasks_presets
          - md_to_emails
          - pbs_configuration
          - phone
          - prodtargethrs
          - production_config
          - schedule_end_time
          - schedule_start_time
          - scoreboard_target
          - shopname
          - shoprates
          - speedprint
          - ss_configuration
          - ssbuckets
          - state
          - state_tax_id
          - target_touchtime
          - timezone
          - tt_allow_post_to_invoiced
          - tt_enforce_hours_for_tech_console
          - updated_at
          - use_fippa
          - use_paint_scale_data
          - uselocalmediaserver
          - website
          - workingdays
          - zip_post
        filter:
          associations:
            _and:
              - user:
                  authid:
                    _eq: X-Hasura-User-Id
              - active:
                  _eq: true
        check: null
- table:
    name: cccontracts
    schema: public
  object_relationships:
    - name: courtesycar
      using:
        foreign_key_constraint_on: courtesycarid
    - name: job
      using:
        foreign_key_constraint_on: jobid
  insert_permissions:
    - role: user
      permission:
        check:
          courtesycar:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        columns:
          - actax
          - actualreturn
          - agreementnumber
          - cleanupcharge
          - contract_date
          - courtesycarid
          - coverage
          - created_at
          - dailyfreekm
          - dailyrate
          - damage
          - damagewaiver
          - driver_addr1
          - driver_addr2
          - driver_city
          - driver_dlexpiry
          - driver_dlnumber
          - driver_dlst
          - driver_dob
          - driver_fn
          - driver_ln
          - driver_ph1
          - driver_state
          - driver_zip
          - excesskmrate
          - federaltax
          - fuelin
          - fuelout
          - id
          - jobid
          - kmend
          - kmstart
          - localtax
          - refuelcharge
          - scheduledreturn
          - start
          - statetax
          - status
          - updated_at
  select_permissions:
    - role: user
      permission:
        columns:
          - actax
          - actualreturn
          - agreementnumber
          - cleanupcharge
          - contract_date
          - courtesycarid
          - coverage
          - created_at
          - dailyfreekm
          - dailyrate
          - damage
          - damagewaiver
          - driver_addr1
          - driver_addr2
          - driver_city
          - driver_dlexpiry
          - driver_dlnumber
          - driver_dlst
          - driver_dob
          - driver_fn
          - driver_ln
          - driver_ph1
          - driver_state
          - driver_zip
          - excesskmrate
          - federaltax
          - fuelin
          - fuelout
          - id
          - jobid
          - kmend
          - kmstart
          - localtax
          - refuelcharge
          - scheduledreturn
          - start
          - statetax
          - status
          - updated_at
        filter:
          courtesycar:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - actax
          - actualreturn
          - agreementnumber
          - cleanupcharge
          - contract_date
          - courtesycarid
          - coverage
          - created_at
          - dailyfreekm
          - dailyrate
          - damage
          - damagewaiver
          - driver_addr1
          - driver_addr2
          - driver_city
          - driver_dlexpiry
          - driver_dlnumber
          - driver_dlst
          - driver_dob
          - driver_fn
          - driver_ln
          - driver_ph1
          - driver_state
          - driver_zip
          - excesskmrate
          - federaltax
          - fuelin
          - fuelout
          - id
          - jobid
          - kmend
          - kmstart
          - localtax
          - refuelcharge
          - scheduledreturn
          - start
          - statetax
          - status
          - updated_at
        filter:
          courtesycar:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          courtesycar:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
- table:
    name: conversations
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
  array_relationships:
    - name: job_conversations
      using:
        foreign_key_constraint_on:
          column: conversationid
          table:
            name: job_conversations
            schema: public
    - name: messages
      using:
        foreign_key_constraint_on:
          column: conversationid
          table:
            name: messages
            schema: public
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - bodyshopid
          - created_at
          - id
          - label
          - phone_num
          - unreadcnt
          - updated_at
  select_permissions:
    - role: user
      permission:
        columns:
          - archived
          - bodyshopid
          - created_at
          - id
          - label
          - phone_num
          - unreadcnt
          - updated_at
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - archived
          - bodyshopid
          - created_at
          - id
          - label
          - phone_num
          - unreadcnt
          - updated_at
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        check: null
- table:
    name: counters
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: shopid
- table:
    name: courtesycars
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
  array_relationships:
    - name: cccontracts
      using:
        foreign_key_constraint_on:
          column: courtesycarid
          table:
            name: cccontracts
            schema: public
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - bodyshopid
          - color
          - created_at
          - dailycost
          - damage
          - fleetnumber
          - fuel
          - id
          - insuranceexpires
          - leaseenddate
          - make
          - mileage
          - model
          - nextservicedate
          - nextservicekm
          - notes
          - plate
          - purchasedate
          - readiness
          - registrationexpires
          - serviceenddate
          - servicestartdate
          - status
          - updated_at
          - vin
          - year
  select_permissions:
    - role: user
      permission:
        columns:
          - bodyshopid
          - color
          - created_at
          - dailycost
          - damage
          - fleetnumber
          - fuel
          - id
          - insuranceexpires
          - leaseenddate
          - make
          - mileage
          - model
          - nextservicedate
          - nextservicekm
          - notes
          - plate
          - purchasedate
          - readiness
          - registrationexpires
          - serviceenddate
          - servicestartdate
          - status
          - updated_at
          - vin
          - year
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - bodyshopid
          - color
          - created_at
          - dailycost
          - damage
          - fleetnumber
          - fuel
          - id
          - insuranceexpires
          - leaseenddate
          - make
          - mileage
          - model
          - nextservicedate
          - nextservicekm
          - notes
          - plate
          - purchasedate
          - readiness
          - registrationexpires
          - serviceenddate
          - servicestartdate
          - status
          - updated_at
          - vin
          - year
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
- table:
    name: csi
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
    - name: csiquestion
      using:
        foreign_key_constraint_on: questionset
    - name: job
      using:
        foreign_key_constraint_on: jobid
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - bodyshopid
          - created_at
          - id
          - jobid
          - questionset
          - relateddata
          - updated_at
          - valid
          - validuntil
  select_permissions:
    - role: anonymous
      permission:
        columns:
          - id
          - relateddata
          - valid
          - validuntil
        filter:
          valid:
            _eq: true
        limit: 1
    - role: user
      permission:
        columns:
          - bodyshopid
          - completedon
          - created_at
          - id
          - jobid
          - questionset
          - relateddata
          - response
          - updated_at
          - valid
          - validuntil
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        allow_aggregations: true
  update_permissions:
    - role: anonymous
      permission:
        columns:
          - completedon
          - response
          - valid
        filter:
          valid:
            _eq: true
        check: null
    - role: user
      permission:
        columns:
          - bodyshopid
          - completedon
          - created_at
          - id
          - jobid
          - relateddata
          - updated_at
          - valid
          - validuntil
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        check: null
- table:
    name: csiquestions
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
  array_relationships:
    - name: csis
      using:
        foreign_key_constraint_on:
          column: questionset
          table:
            name: csi
            schema: public
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - current
          - config
          - created_at
          - updated_at
          - bodyshopid
          - id
  select_permissions:
    - role: anonymous
      permission:
        columns:
          - config
          - id
        filter: {}
        limit: 1
    - role: user
      permission:
        columns:
          - current
          - config
          - created_at
          - updated_at
          - bodyshopid
          - id
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
  update_permissions:
    - role: user
      permission:
        columns:
          - current
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        check: null
- table:
    name: dms_vehicles
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - id
          - created_at
          - makecode
          - modelcode
          - make
          - model
          - bodyshopid
  select_permissions:
    - role: user
      permission:
        columns:
          - id
          - created_at
          - makecode
          - modelcode
          - make
          - model
          - bodyshopid
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
  update_permissions:
    - role: user
      permission:
        columns:
          - make
          - makecode
          - model
          - modelcode
          - created_at
          - bodyshopid
          - id
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
- table:
    name: documents
    schema: public
  object_relationships:
    - name: bill
      using:
        foreign_key_constraint_on: billid
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
    - name: job
      using:
        foreign_key_constraint_on: jobid
  insert_permissions:
    - role: user
      permission:
        check:
          _or:
            - job:
                bodyshop:
                  associations:
                    _and:
                      - user:
                          authid:
                            _eq: X-Hasura-User-Id
                      - active:
                          _eq: true
            - bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
        columns:
          - billid
          - bodyshopid
          - created_at
          - extension
          - id
          - jobid
          - key
          - name
          - size
          - takenat
          - type
          - updated_at
          - uploaded_by
  select_permissions:
    - role: user
      permission:
        columns:
          - billid
          - bodyshopid
          - created_at
          - extension
          - id
          - jobid
          - key
          - name
          - size
          - takenat
          - type
          - updated_at
          - uploaded_by
        filter:
          _or:
            - job:
                bodyshop:
                  associations:
                    _and:
                      - user:
                          authid:
                            _eq: X-Hasura-User-Id
                      - active:
                          _eq: true
            - bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - extension
          - key
          - name
          - type
          - uploaded_by
          - created_at
          - updated_at
          - billid
          - bodyshopid
          - id
          - jobid
        filter:
          _or:
            - job:
                bodyshop:
                  associations:
                    _and:
                      - user:
                          authid:
                            _eq: X-Hasura-User-Id
                      - active:
                          _eq: true
            - bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          _or:
            - job:
                bodyshop:
                  associations:
                    _and:
                      - user:
                          authid:
                            _eq: X-Hasura-User-Id
                      - active:
                          _eq: true
            - bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
- table:
    name: email_audit_trail
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
    - name: job
      using:
        foreign_key_constraint_on: jobid
    - name: user
      using:
        foreign_key_constraint_on: useremail
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - cc
          - to
          - contents
          - subject
          - useremail
          - created_at
          - updated_at
          - bodyshopid
          - id
          - jobid
          - noteid
  select_permissions:
    - role: user
      permission:
        columns:
          - bodyshopid
          - cc
          - contents
          - created_at
          - id
          - jobid
          - noteid
          - status
          - status_context
          - subject
          - to
          - updated_at
          - useremail
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
  update_permissions:
    - role: user
      permission:
        columns:
          - cc
          - to
          - contents
          - subject
          - useremail
          - created_at
          - updated_at
          - bodyshopid
          - id
          - jobid
          - noteid
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        check: null
- table:
    name: employee_team_members
    schema: public
  object_relationships:
    - name: employee
      using:
        foreign_key_constraint_on: employeeid
    - name: employee_team
      using:
        foreign_key_constraint_on: teamid
  insert_permissions:
    - role: user
      permission:
        check:
          employee_team:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        columns:
          - created_at
          - employeeid
          - id
          - labor_rates
          - percentage
          - teamid
          - updated_at
  select_permissions:
    - role: user
      permission:
        columns:
          - created_at
          - employeeid
          - id
          - labor_rates
          - percentage
          - teamid
          - updated_at
        filter:
          employee_team:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
  update_permissions:
    - role: user
      permission:
        columns:
          - created_at
          - employeeid
          - id
          - labor_rates
          - percentage
          - teamid
          - updated_at
        filter:
          employee_team:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          employee_team:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
- table:
    name: employee_teams
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
  array_relationships:
    - name: employee_team_members
      using:
        foreign_key_constraint_on:
          column: teamid
          table:
            name: employee_team_members
            schema: public
    - name: joblines
      using:
        foreign_key_constraint_on:
          column: assigned_team
          table:
            name: joblines
            schema: public
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - active
          - bodyshopid
          - created_at
          - id
          - max_load
          - name
          - updated_at
  select_permissions:
    - role: user
      permission:
        columns:
          - active
          - bodyshopid
          - created_at
          - id
          - max_load
          - name
          - updated_at
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
  update_permissions:
    - role: user
      permission:
        columns:
          - active
          - bodyshopid
          - max_load
          - name
          - updated_at
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        check: null
- table:
    name: employee_vacation
    schema: public
  object_relationships:
    - name: employee
      using:
        foreign_key_constraint_on: employeeid
  insert_permissions:
    - role: user
      permission:
        check:
          employee:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        columns:
          - id
          - created_at
          - updated_at
          - employeeid
          - start
          - end
  select_permissions:
    - role: user
      permission:
        columns:
          - end
          - start
          - created_at
          - updated_at
          - employeeid
          - id
        filter:
          employee:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
  update_permissions:
    - role: user
      permission:
        columns:
          - end
          - start
          - created_at
          - updated_at
          - employeeid
          - id
        filter:
          employee:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          employee:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
- table:
    name: employees
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: shopid
    - name: user
      using:
        foreign_key_constraint_on: user_email
  array_relationships:
    - name: allocations
      using:
        foreign_key_constraint_on:
          column: employeeid
          table:
            name: allocations
            schema: public
    - name: employee_team_members
      using:
        foreign_key_constraint_on:
          column: employeeid
          table:
            name: employee_team_members
            schema: public
    - name: employee_vacations
      using:
        foreign_key_constraint_on:
          column: employeeid
          table:
            name: employee_vacation
            schema: public
    - name: jobsByEmployeeBody
      using:
        foreign_key_constraint_on:
          column: employee_body
          table:
            name: jobs
            schema: public
    - name: jobsByEmployeeCsr
      using:
        foreign_key_constraint_on:
          column: employee_csr
          table:
            name: jobs
            schema: public
    - name: jobsByEmployeePrep
      using:
        foreign_key_constraint_on:
          column: employee_prep
          table:
            name: jobs
            schema: public
    - name: jobsByEmployeeRefinish
      using:
        foreign_key_constraint_on:
          column: employee_refinish
          table:
            name: jobs
            schema: public
    - name: tasks
      using:
        foreign_key_constraint_on:
          column: assigned_to
          table:
            name: tasks
            schema: public
    - name: timetickets
      using:
        foreign_key_constraint_on:
          column: employeeid
          table:
            name: timetickets
            schema: public
    - name: tt_approval_queues
      using:
        foreign_key_constraint_on:
          column: employeeid
          table:
            name: tt_approval_queue
            schema: public
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - active
          - created_at
          - employee_number
          - external_id
          - first_name
          - flat_rate
          - hire_date
          - id
          - last_name
          - pin
          - rates
          - shopid
          - termination_date
          - updated_at
          - user_email
  select_permissions:
    - role: user
      permission:
        columns:
          - active
          - created_at
          - employee_number
          - external_id
          - first_name
          - flat_rate
          - hire_date
          - id
          - last_name
          - pin
          - rates
          - shopid
          - termination_date
          - updated_at
          - user_email
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - active
          - created_at
          - employee_number
          - external_id
          - first_name
          - flat_rate
          - hire_date
          - id
          - last_name
          - pin
          - rates
          - shopid
          - termination_date
          - updated_at
          - user_email
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
- table:
    name: eula_acceptances
    schema: public
  object_relationships:
    - name: eula
      using:
        foreign_key_constraint_on: eulaid
    - name: user
      using:
        foreign_key_constraint_on: useremail
  insert_permissions:
    - role: user
      permission:
        check:
          user:
            authid:
              _eq: X-Hasura-User-Id
        columns:
          - address
          - business_name
          - date_accepted
          - eulaid
          - first_name
          - last_name
          - phone_number
          - useremail
  select_permissions:
    - role: user
      permission:
        columns:
          - address
          - business_name
          - first_name
          - last_name
          - phone_number
          - useremail
          - created_at
          - date_accepted
          - updated_at
          - eulaid
          - id
        filter:
          user:
            authid:
              _eq: X-Hasura-User-Id
- table:
    name: eulas
    schema: public
  array_relationships:
    - name: eula_acceptances
      using:
        foreign_key_constraint_on:
          column: eulaid
          table:
            name: eula_acceptances
            schema: public
  select_permissions:
    - role: user
      permission:
        columns:
          - id
          - created_at
          - updated_at
          - effective_date
          - end_date
          - content
        filter: {}
- table:
    name: exportlog
    schema: public
  object_relationships:
    - name: bill
      using:
        foreign_key_constraint_on: billid
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
    - name: job
      using:
        foreign_key_constraint_on: jobid
    - name: payment
      using:
        foreign_key_constraint_on: paymentid
    - name: user
      using:
        foreign_key_constraint_on: useremail
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - billid
          - bodyshopid
          - created_at
          - id
          - jobid
          - message
          - metadata
          - paymentid
          - successful
          - updated_at
          - useremail
  select_permissions:
    - role: user
      permission:
        columns:
          - billid
          - bodyshopid
          - created_at
          - id
          - jobid
          - message
          - metadata
          - paymentid
          - successful
          - updated_at
          - useremail
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        allow_aggregations: true
- table:
    name: inventory
    schema: public
  object_relationships:
    - name: bill
      using:
        foreign_key_constraint_on: consumedbybillid
    - name: billline
      using:
        foreign_key_constraint_on: billlineid
    - name: bodyshop
      using:
        foreign_key_constraint_on: shopid
    - name: jobline
      using:
        foreign_key_constraint_on: joblineid
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - actual_cost
          - actual_price
          - billlineid
          - comment
          - consumedbybillid
          - created_at
          - id
          - joblineid
          - line_desc
          - manualinvoicenumber
          - manualvendor
          - quantity
          - shopid
          - updated_at
  select_permissions:
    - role: user
      permission:
        columns:
          - actual_cost
          - actual_price
          - billlineid
          - comment
          - consumedbybillid
          - created_at
          - id
          - joblineid
          - line_desc
          - manualinvoicenumber
          - manualvendor
          - quantity
          - shopid
          - updated_at
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - actual_cost
          - actual_price
          - billlineid
          - comment
          - consumedbybillid
          - created_at
          - id
          - joblineid
          - line_desc
          - manualinvoicenumber
          - manualvendor
          - quantity
          - shopid
          - updated_at
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
- table:
    name: ioevents
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
    - name: user
      using:
        foreign_key_constraint_on: useremail
- table:
    name: job_ar_schema
    schema: public
  object_relationships:
    - name: job
      using:
        foreign_key_constraint_on: id
  select_permissions:
    - role: user
      permission:
        columns:
          - id
          - ro_number
          - clm_total
          - total_payments
          - balance
          - date_invoiced
          - shopid
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - active:
                      _eq: true
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
- table:
    name: job_conversations
    schema: public
  object_relationships:
    - name: conversation
      using:
        foreign_key_constraint_on: conversationid
    - name: job
      using:
        foreign_key_constraint_on: jobid
  insert_permissions:
    - role: user
      permission:
        check:
          conversation:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        columns:
          - conversationid
          - id
          - jobid
  select_permissions:
    - role: user
      permission:
        columns:
          - conversationid
          - id
          - jobid
        filter:
          conversation:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
  update_permissions:
    - role: user
      permission:
        columns:
          - conversationid
          - jobid
        filter:
          conversation:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          conversation:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
- table:
    name: joblines
    schema: public
  object_relationships:
    - name: employee_team
      using:
        foreign_key_constraint_on: assigned_team
    - name: job
      using:
        foreign_key_constraint_on: jobid
  array_relationships:
    - name: allocations
      using:
        foreign_key_constraint_on:
          column: joblineid
          table:
            name: allocations
            schema: public
    - name: billlines
      using:
        foreign_key_constraint_on:
          column: joblineid
          table:
            name: billlines
            schema: public
    - name: inventories
      using:
        foreign_key_constraint_on:
          column: joblineid
          table:
            name: inventory
            schema: public
    - name: parts_dispatch_lines
      using:
        foreign_key_constraint_on:
          column: joblineid
          table:
            name: parts_dispatch_lines
            schema: public
    - name: parts_order_lines
      using:
        foreign_key_constraint_on:
          column: job_line_id
          table:
            name: parts_order_lines
            schema: public
    - name: tasks
      using:
        foreign_key_constraint_on:
          column: joblineid
          table:
            name: tasks
            schema: public
  insert_permissions:
    - role: user
      permission:
        check:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        columns:
          - act_price
          - act_price_before_ppc
          - ah_detail_line
          - alt_co_id
          - alt_overrd
          - alt_part_i
          - alt_partm
          - alt_partno
          - assigned_team
          - bett_amt
          - bett_pctg
          - bett_tax
          - bett_type
          - cert_part
          - convertedtolbr
          - convertedtolbr_data
          - created_at
          - critical
          - db_hrs
          - db_price
          - db_ref
          - est_seq
          - glass_flag
          - id
          - ioucreated
          - jobid
          - lbr_amt
          - lbr_hrs_j
          - lbr_inc
          - lbr_op
          - lbr_op_j
          - lbr_tax
          - lbr_typ_j
          - line_desc
          - line_ind
          - line_no
          - line_ref
          - location
          - manual_line
          - misc_amt
          - misc_sublt
          - misc_tax
          - mod_lb_hrs
          - mod_lbr_ty
          - notes
          - oem_partno
          - op_code_desc
          - paint_stg
          - paint_tone
          - part_qty
          - part_type
          - price_inc
          - price_j
          - profitcenter_labor
          - profitcenter_part
          - prt_dsmk_m
          - prt_dsmk_p
          - removed
          - status
          - sublet_completed
          - sublet_ignored
          - tax_part
          - tran_code
          - unq_seq
          - updated_at
  select_permissions:
    - role: user
      permission:
        columns:
          - act_price
          - act_price_before_ppc
          - ah_detail_line
          - alt_co_id
          - alt_overrd
          - alt_part_i
          - alt_partm
          - alt_partno
          - assigned_team
          - bett_amt
          - bett_pctg
          - bett_tax
          - bett_type
          - cert_part
          - convertedtolbr
          - convertedtolbr_data
          - created_at
          - critical
          - db_hrs
          - db_price
          - db_ref
          - est_seq
          - glass_flag
          - id
          - ioucreated
          - jobid
          - lbr_amt
          - lbr_hrs_j
          - lbr_inc
          - lbr_op
          - lbr_op_j
          - lbr_tax
          - lbr_typ_j
          - line_desc
          - line_ind
          - line_no
          - line_ref
          - location
          - manual_line
          - misc_amt
          - misc_sublt
          - misc_tax
          - mod_lb_hrs
          - mod_lbr_ty
          - notes
          - oem_partno
          - op_code_desc
          - paint_stg
          - paint_tone
          - part_qty
          - part_type
          - price_inc
          - price_j
          - profitcenter_labor
          - profitcenter_part
          - prt_dsmk_m
          - prt_dsmk_p
          - removed
          - status
          - sublet_completed
          - sublet_ignored
          - tax_part
          - tran_code
          - unq_seq
          - updated_at
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - act_price
          - act_price_before_ppc
          - ah_detail_line
          - alt_co_id
          - alt_overrd
          - alt_part_i
          - alt_partm
          - alt_partno
          - assigned_team
          - bett_amt
          - bett_pctg
          - bett_tax
          - bett_type
          - cert_part
          - convertedtolbr
          - convertedtolbr_data
          - created_at
          - critical
          - db_hrs
          - db_price
          - db_ref
          - est_seq
          - glass_flag
          - id
          - ioucreated
          - jobid
          - lbr_amt
          - lbr_hrs_j
          - lbr_inc
          - lbr_op
          - lbr_op_j
          - lbr_tax
          - lbr_typ_j
          - line_desc
          - line_ind
          - line_no
          - line_ref
          - location
          - manual_line
          - misc_amt
          - misc_sublt
          - misc_tax
          - mod_lb_hrs
          - mod_lbr_ty
          - notes
          - oem_partno
          - op_code_desc
          - paint_stg
          - paint_tone
          - part_qty
          - part_type
          - price_inc
          - price_j
          - profitcenter_labor
          - profitcenter_part
          - prt_dsmk_m
          - prt_dsmk_p
          - removed
          - status
          - sublet_completed
          - sublet_ignored
          - tax_part
          - tran_code
          - unq_seq
          - updated_at
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        check:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
- table:
    name: joblines_status
    schema: public
  object_relationships:
    - name: job
      using:
        manual_configuration:
          column_mapping:
            jobid: id
          insertion_order: null
          remote_table:
            name: jobs
            schema: public
  select_permissions:
    - role: user
      permission:
        columns:
          - jobid
          - status
          - count
          - part_type
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
- table:
    name: jobs
    schema: public
  object_relationships:
    - name: bill
      using:
        manual_configuration:
          column_mapping:
            id: jobid
          insertion_order: null
          remote_table:
            name: bills
            schema: public
    - name: bodyshop
      using:
        foreign_key_constraint_on: shopid
    - name: employee_body_rel
      using:
        foreign_key_constraint_on: employee_body
    - name: employee_csr_rel
      using:
        foreign_key_constraint_on: employee_csr
    - name: employee_prep_rel
      using:
        foreign_key_constraint_on: employee_prep
    - name: employee_refinish_rel
      using:
        foreign_key_constraint_on: employee_refinish
    - name: iouparent_rel
      using:
        foreign_key_constraint_on: iouparent
    - name: owner
      using:
        foreign_key_constraint_on: ownerid
    - name: vehicle
      using:
        foreign_key_constraint_on: vehicleid
  array_relationships:
    - name: appointments
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: appointments
            schema: public
    - name: audit_trails
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: audit_trail
            schema: public
    - name: available_jobs
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: available_jobs
            schema: public
    - name: bills
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: bills
            schema: public
    - name: cccontracts
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: cccontracts
            schema: public
    - name: csiinvites
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: csi
            schema: public
    - name: documents
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: documents
            schema: public
    - name: email_audit_trails
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: email_audit_trail
            schema: public
    - name: exportlogs
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: exportlog
            schema: public
    - name: ious
      using:
        foreign_key_constraint_on:
          column: iouparent
          table:
            name: jobs
            schema: public
    - name: job_conversations
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: job_conversations
            schema: public
    - name: joblines
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: joblines
            schema: public
    - name: joblines_status
      using:
        manual_configuration:
          column_mapping:
            id: jobid
          insertion_order: null
          remote_table:
            name: joblines_status
            schema: public
    - name: mixdata
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: mixdata
            schema: public
    - name: notes
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: notes
            schema: public
    - name: parts_dispatches
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: parts_dispatch
            schema: public
    - name: parts_orders
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: parts_orders
            schema: public
    - name: payment_responses
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: payment_response
            schema: public
    - name: payments
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: payments
            schema: public
    - name: relatedjobs_child
      using:
        foreign_key_constraint_on:
          column: childjob
          table:
            name: relatedjobs
            schema: public
    - name: relatedjobs_parent
      using:
        foreign_key_constraint_on:
          column: parentjob
          table:
            name: relatedjobs
            schema: public
    - name: scoreboards
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: scoreboard
            schema: public
    - name: tasks
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: tasks
            schema: public
    - name: timetickets
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: timetickets
            schema: public
    - name: transitions
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: transitions
            schema: public
    - name: tt_approval_queues
      using:
        foreign_key_constraint_on:
          column: jobid
          table:
            name: tt_approval_queue
            schema: public
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - actual_completion
          - actual_delivery
          - actual_in
          - adj_g_disc
          - adj_strdis
          - adj_towdis
          - adjustment_bottom_line
          - agt_addr1
          - agt_addr2
          - agt_city
          - agt_co_id
          - agt_co_nm
          - agt_ct_fn
          - agt_ct_ln
          - agt_ct_ph
          - agt_ct_phx
          - agt_ctry
          - agt_ea
          - agt_fax
          - agt_faxx
          - agt_lic_no
          - agt_ph1
          - agt_ph1x
          - agt_ph2
          - agt_ph2x
          - agt_st
          - agt_zip
          - alt_transport
          - area_of_damage
          - asgn_date
          - asgn_no
          - asgn_type
          - auto_add_ats
          - ca_bc_pvrt
          - ca_customer_gst
          - ca_gst_registrant
          - cat_no
          - category
          - cieca_pfl
          - cieca_pfo
          - cieca_pft
          - cieca_stl
          - cieca_ttl
          - ciecaid
          - class
          - clm_addr1
          - clm_addr2
          - clm_city
          - clm_ct_fn
          - clm_ct_ln
          - clm_ct_ph
          - clm_ct_phx
          - clm_ctry
          - clm_ea
          - clm_fax
          - clm_faxx
          - clm_no
          - clm_ofc_id
          - clm_ofc_nm
          - clm_ph1
          - clm_ph1x
          - clm_ph2
          - clm_ph2x
          - clm_st
          - clm_title
          - clm_total
          - clm_zip
          - comment
          - completed_tasks
          - converted
          - created_at
          - cust_pr
          - date_estimated
          - date_exported
          - date_invoiced
          - date_last_contacted
          - date_next_contact
          - date_open
          - date_rentalresp
          - date_repairstarted
          - date_scheduled
          - date_towin
          - date_void
          - ded_amt
          - ded_note
          - ded_status
          - deliverchecklist
          - depreciation_taxes
          - dms_allocation
          - driveable
          - employee_body
          - employee_csr
          - employee_prep
          - employee_refinish
          - est_addr1
          - est_addr2
          - est_city
          - est_co_nm
          - est_ct_fn
          - est_ct_ln
          - est_ctry
          - est_ea
          - est_ph1
          - est_st
          - est_zip
          - federal_tax_rate
          - g_bett_amt
          - id
          - inproduction
          - ins_addr1
          - ins_addr2
          - ins_city
          - ins_co_id
          - ins_co_nm
          - ins_ct_fn
          - ins_ct_ln
          - ins_ct_ph
          - ins_ct_phx
          - ins_ctry
          - ins_ea
          - ins_fax
          - ins_faxx
          - ins_memo
          - ins_ph1
          - ins_ph1x
          - ins_ph2
          - ins_ph2x
          - ins_st
          - ins_title
          - ins_zip
          - insd_addr1
          - insd_addr2
          - insd_city
          - insd_co_nm
          - insd_ctry
          - insd_ea
          - insd_fax
          - insd_faxx
          - insd_fn
          - insd_ln
          - insd_ph1
          - insd_ph1x
          - insd_ph2
          - insd_ph2x
          - insd_st
          - insd_title
          - insd_zip
          - intakechecklist
          - invoice_allocation
          - invoice_date
          - invoice_final_note
          - iouparent
          - job_totals
          - kanbanparent
          - kmin
          - kmout
          - labor_rate_desc
          - labor_rate_id
          - lbr_adjustments
          - local_tax_rate
          - loss_cat
          - loss_date
          - loss_desc
          - loss_of_use
          - loss_type
          - materials
          - other_amount_payable
          - owner_owing
          - ownerid
          - ownr_addr1
          - ownr_addr2
          - ownr_city
          - ownr_co_nm
          - ownr_ctry
          - ownr_ea
          - ownr_fax
          - ownr_faxx
          - ownr_fn
          - ownr_ln
          - ownr_ph1
          - ownr_ph1x
          - ownr_ph2
          - ownr_ph2x
          - ownr_st
          - ownr_title
          - ownr_zip
          - parts_tax_rates
          - pay_amt
          - pay_chknm
          - pay_date
          - pay_type
          - payee_nms
          - plate_no
          - plate_st
          - po_number
          - policy_no
          - production_vars
          - qb_multiple_payers
          - queued_for_parts
          - rate_ats
          - rate_la1
          - rate_la2
          - rate_la3
          - rate_la4
          - rate_laa
          - rate_lab
          - rate_lad
          - rate_lae
          - rate_laf
          - rate_lag
          - rate_lam
          - rate_lar
          - rate_las
          - rate_lau
          - rate_ma2s
          - rate_ma2t
          - rate_ma3s
          - rate_mabl
          - rate_macs
          - rate_mahw
          - rate_mapa
          - rate_mash
          - rate_matd
          - referral_source
          - referral_source_extra
          - regie_number
          - ro_number
          - scheduled_completion
          - scheduled_delivery
          - scheduled_in
          - selling_dealer
          - selling_dealer_contact
          - servicing_dealer
          - servicing_dealer_contact
          - shopid
          - special_coverage_policy
          - state_tax_rate
          - status
          - storage_payable
          - suspended
          - tax_lbr_rt
          - tax_levies_rt
          - tax_paint_mat_rt
          - tax_predis
          - tax_prethr
          - tax_pstthr
          - tax_registration_number
          - tax_shop_mat_rt
          - tax_str_rt
          - tax_sub_rt
          - tax_thramt
          - tax_tow_rt
          - theft_ind
          - tlos_ind
          - towin
          - towing_payable
          - unit_number
          - updated_at
          - v_color
          - v_make_desc
          - v_model_desc
          - v_model_yr
          - v_vin
          - vehicleid
          - voided
  select_permissions:
    - role: user
      permission:
        columns:
          - actual_completion
          - actual_delivery
          - actual_in
          - adj_g_disc
          - adj_strdis
          - adj_towdis
          - adjustment_bottom_line
          - agt_addr1
          - agt_addr2
          - agt_city
          - agt_co_id
          - agt_co_nm
          - agt_ct_fn
          - agt_ct_ln
          - agt_ct_ph
          - agt_ct_phx
          - agt_ctry
          - agt_ea
          - agt_fax
          - agt_faxx
          - agt_lic_no
          - agt_ph1
          - agt_ph1x
          - agt_ph2
          - agt_ph2x
          - agt_st
          - agt_zip
          - alt_transport
          - area_of_damage
          - asgn_date
          - asgn_no
          - asgn_type
          - auto_add_ats
          - ca_bc_pvrt
          - ca_customer_gst
          - ca_gst_registrant
          - cat_no
          - category
          - cieca_pfl
          - cieca_pfo
          - cieca_pft
          - cieca_stl
          - cieca_ttl
          - ciecaid
          - class
          - clm_addr1
          - clm_addr2
          - clm_city
          - clm_ct_fn
          - clm_ct_ln
          - clm_ct_ph
          - clm_ct_phx
          - clm_ctry
          - clm_ea
          - clm_fax
          - clm_faxx
          - clm_no
          - clm_ofc_id
          - clm_ofc_nm
          - clm_ph1
          - clm_ph1x
          - clm_ph2
          - clm_ph2x
          - clm_st
          - clm_title
          - clm_total
          - clm_zip
          - comment
          - completed_tasks
          - converted
          - created_at
          - cust_pr
          - date_estimated
          - date_exported
          - date_invoiced
          - date_last_contacted
          - date_lost_sale
          - date_next_contact
          - date_open
          - date_rentalresp
          - date_repairstarted
          - date_scheduled
          - date_towin
          - date_void
          - ded_amt
          - ded_note
          - ded_status
          - deliverchecklist
          - depreciation_taxes
          - dms_allocation
          - driveable
          - employee_body
          - employee_csr
          - employee_prep
          - employee_refinish
          - est_addr1
          - est_addr2
          - est_city
          - est_co_nm
          - est_ct_fn
          - est_ct_ln
          - est_ctry
          - est_ea
          - est_ph1
          - est_st
          - est_zip
          - federal_tax_rate
          - g_bett_amt
          - id
          - inproduction
          - ins_addr1
          - ins_addr2
          - ins_city
          - ins_co_id
          - ins_co_nm
          - ins_ct_fn
          - ins_ct_ln
          - ins_ct_ph
          - ins_ct_phx
          - ins_ctry
          - ins_ea
          - ins_fax
          - ins_faxx
          - ins_memo
          - ins_ph1
          - ins_ph1x
          - ins_ph2
          - ins_ph2x
          - ins_st
          - ins_title
          - ins_zip
          - insd_addr1
          - insd_addr2
          - insd_city
          - insd_co_nm
          - insd_ctry
          - insd_ea
          - insd_fax
          - insd_faxx
          - insd_fn
          - insd_ln
          - insd_ph1
          - insd_ph1x
          - insd_ph2
          - insd_ph2x
          - insd_st
          - insd_title
          - insd_zip
          - intakechecklist
          - invoice_allocation
          - invoice_date
          - invoice_final_note
          - iouparent
          - job_totals
          - kanbanparent
          - kmin
          - kmout
          - labor_rate_desc
          - labor_rate_id
          - lbr_adjustments
          - local_tax_rate
          - loss_cat
          - loss_date
          - loss_desc
          - loss_of_use
          - loss_type
          - lost_sale_reason
          - materials
          - other_amount_payable
          - owner_owing
          - ownerid
          - ownr_addr1
          - ownr_addr2
          - ownr_city
          - ownr_co_nm
          - ownr_ctry
          - ownr_ea
          - ownr_fax
          - ownr_faxx
          - ownr_fn
          - ownr_ln
          - ownr_ph1
          - ownr_ph1x
          - ownr_ph2
          - ownr_ph2x
          - ownr_st
          - ownr_title
          - ownr_zip
          - parts_tax_rates
          - pay_amt
          - pay_chknm
          - pay_date
          - pay_type
          - payee_nms
          - plate_no
          - plate_st
          - po_number
          - policy_no
          - production_vars
          - qb_multiple_payers
          - queued_for_parts
          - rate_ats
          - rate_la1
          - rate_la2
          - rate_la3
          - rate_la4
          - rate_laa
          - rate_lab
          - rate_lad
          - rate_lae
          - rate_laf
          - rate_lag
          - rate_lam
          - rate_lar
          - rate_las
          - rate_lau
          - rate_ma2s
          - rate_ma2t
          - rate_ma3s
          - rate_mabl
          - rate_macs
          - rate_mahw
          - rate_mapa
          - rate_mash
          - rate_matd
          - referral_source
          - referral_source_extra
          - regie_number
          - remove_from_ar
          - ro_number
          - scheduled_completion
          - scheduled_delivery
          - scheduled_in
          - selling_dealer
          - selling_dealer_contact
          - servicing_dealer
          - servicing_dealer_contact
          - shopid
          - special_coverage_policy
          - state_tax_rate
          - status
          - storage_payable
          - suspended
          - tax_lbr_rt
          - tax_levies_rt
          - tax_paint_mat_rt
          - tax_predis
          - tax_prethr
          - tax_pstthr
          - tax_registration_number
          - tax_shop_mat_rt
          - tax_str_rt
          - tax_sub_rt
          - tax_thramt
          - tax_tow_rt
          - theft_ind
          - tlos_ind
          - towin
          - towing_payable
          - unit_number
          - updated_at
          - v_color
          - v_make_desc
          - v_model_desc
          - v_model_yr
          - v_vin
          - vehicleid
          - voided
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - actual_completion
          - actual_delivery
          - actual_in
          - adj_g_disc
          - adj_strdis
          - adj_towdis
          - adjustment_bottom_line
          - agt_addr1
          - agt_addr2
          - agt_city
          - agt_co_id
          - agt_co_nm
          - agt_ct_fn
          - agt_ct_ln
          - agt_ct_ph
          - agt_ct_phx
          - agt_ctry
          - agt_ea
          - agt_fax
          - agt_faxx
          - agt_lic_no
          - agt_ph1
          - agt_ph1x
          - agt_ph2
          - agt_ph2x
          - agt_st
          - agt_zip
          - alt_transport
          - area_of_damage
          - asgn_date
          - asgn_no
          - asgn_type
          - auto_add_ats
          - ca_bc_pvrt
          - ca_customer_gst
          - ca_gst_registrant
          - cat_no
          - category
          - cieca_pfl
          - cieca_pfo
          - cieca_pft
          - cieca_stl
          - cieca_ttl
          - ciecaid
          - class
          - clm_addr1
          - clm_addr2
          - clm_city
          - clm_ct_fn
          - clm_ct_ln
          - clm_ct_ph
          - clm_ct_phx
          - clm_ctry
          - clm_ea
          - clm_fax
          - clm_faxx
          - clm_no
          - clm_ofc_id
          - clm_ofc_nm
          - clm_ph1
          - clm_ph1x
          - clm_ph2
          - clm_ph2x
          - clm_st
          - clm_title
          - clm_total
          - clm_zip
          - comment
          - completed_tasks
          - converted
          - created_at
          - cust_pr
          - date_estimated
          - date_exported
          - date_invoiced
          - date_last_contacted
          - date_lost_sale
          - date_next_contact
          - date_open
          - date_rentalresp
          - date_repairstarted
          - date_scheduled
          - date_towin
          - date_void
          - ded_amt
          - ded_note
          - ded_status
          - deliverchecklist
          - depreciation_taxes
          - dms_allocation
          - driveable
          - employee_body
          - employee_csr
          - employee_prep
          - employee_refinish
          - est_addr1
          - est_addr2
          - est_city
          - est_co_nm
          - est_ct_fn
          - est_ct_ln
          - est_ctry
          - est_ea
          - est_ph1
          - est_st
          - est_zip
          - federal_tax_rate
          - g_bett_amt
          - id
          - inproduction
          - ins_addr1
          - ins_addr2
          - ins_city
          - ins_co_id
          - ins_co_nm
          - ins_ct_fn
          - ins_ct_ln
          - ins_ct_ph
          - ins_ct_phx
          - ins_ctry
          - ins_ea
          - ins_fax
          - ins_faxx
          - ins_memo
          - ins_ph1
          - ins_ph1x
          - ins_ph2
          - ins_ph2x
          - ins_st
          - ins_title
          - ins_zip
          - insd_addr1
          - insd_addr2
          - insd_city
          - insd_co_nm
          - insd_ctry
          - insd_ea
          - insd_fax
          - insd_faxx
          - insd_fn
          - insd_ln
          - insd_ph1
          - insd_ph1x
          - insd_ph2
          - insd_ph2x
          - insd_st
          - insd_title
          - insd_zip
          - intakechecklist
          - invoice_allocation
          - invoice_date
          - invoice_final_note
          - iouparent
          - job_totals
          - kanbanparent
          - kmin
          - kmout
          - labor_rate_desc
          - labor_rate_id
          - lbr_adjustments
          - local_tax_rate
          - loss_cat
          - loss_date
          - loss_desc
          - loss_of_use
          - loss_type
          - lost_sale_reason
          - materials
          - other_amount_payable
          - owner_owing
          - ownerid
          - ownr_addr1
          - ownr_addr2
          - ownr_city
          - ownr_co_nm
          - ownr_ctry
          - ownr_ea
          - ownr_fax
          - ownr_faxx
          - ownr_fn
          - ownr_ln
          - ownr_ph1
          - ownr_ph1x
          - ownr_ph2
          - ownr_ph2x
          - ownr_st
          - ownr_title
          - ownr_zip
          - parts_tax_rates
          - pay_amt
          - pay_chknm
          - pay_date
          - pay_type
          - payee_nms
          - plate_no
          - plate_st
          - po_number
          - policy_no
          - production_vars
          - qb_multiple_payers
          - queued_for_parts
          - rate_ats
          - rate_la1
          - rate_la2
          - rate_la3
          - rate_la4
          - rate_laa
          - rate_lab
          - rate_lad
          - rate_lae
          - rate_laf
          - rate_lag
          - rate_lam
          - rate_lar
          - rate_las
          - rate_lau
          - rate_ma2s
          - rate_ma2t
          - rate_ma3s
          - rate_mabl
          - rate_macs
          - rate_mahw
          - rate_mapa
          - rate_mash
          - rate_matd
          - referral_source
          - referral_source_extra
          - regie_number
          - remove_from_ar
          - ro_number
          - scheduled_completion
          - scheduled_delivery
          - scheduled_in
          - selling_dealer
          - selling_dealer_contact
          - servicing_dealer
          - servicing_dealer_contact
          - shopid
          - special_coverage_policy
          - state_tax_rate
          - status
          - storage_payable
          - suspended
          - tax_lbr_rt
          - tax_levies_rt
          - tax_paint_mat_rt
          - tax_predis
          - tax_prethr
          - tax_pstthr
          - tax_registration_number
          - tax_shop_mat_rt
          - tax_str_rt
          - tax_sub_rt
          - tax_thramt
          - tax_tow_rt
          - theft_ind
          - tlos_ind
          - towin
          - towing_payable
          - unit_number
          - updated_at
          - v_color
          - v_make_desc
          - v_model_desc
          - v_model_yr
          - v_vin
          - vehicleid
          - voided
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
  event_triggers:
    - name: job_status_transition
      definition:
        enable_manual: true
        insert:
          columns: '*'
        update:
          columns:
            - status
      retry_conf:
        interval_sec: 10
        num_retries: 0
        timeout_sec: 60
      webhook_from_env: HASURA_API_URL
      headers:
        - name: event-secret
          value_from_env: EVENT_SECRET
      request_transform:
        method: POST
        query_params: {}
        template_engine: Kriti
        url: '{{$base_url}}/job/statustransition'
        version: 2
    - name: jobs_arms
      definition:
        enable_manual: true
      retry_conf:
        interval_sec: 10
        num_retries: 0
        timeout_sec: 60
      webhook_from_env: HASURA_API_URL
      request_transform:
        method: POST
        query_params: {}
        template_engine: Kriti
        url: '{{$base_url}}/record-handler/arms'
        version: 2
    - name: os_jobs
      definition:
        delete:
          columns: '*'
        enable_manual: false
        insert:
          columns: '*'
        update:
          columns: '*'
      retry_conf:
        interval_sec: 10
        num_retries: 3
        timeout_sec: 60
      webhook_from_env: HASURA_API_URL
      headers:
        - name: event-secret
          value_from_env: EVENT_SECRET
      request_transform:
        method: POST
        query_params: {}
        template_engine: Kriti
        url: '{{$base_url}}/opensearch'
        version: 2
- table:
    name: masterdata
    schema: public
  select_permissions:
    - role: anonymous
      permission:
        columns:
          - key
          - value
        filter: {}
    - role: user
      permission:
        columns:
          - key
          - value
        filter: {}
- table:
    name: messages
    schema: public
  object_relationships:
    - name: conversation
      using:
        foreign_key_constraint_on: conversationid
    - name: user
      using:
        foreign_key_constraint_on: userid
  insert_permissions:
    - role: user
      permission:
        check:
          conversation:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        columns:
          - conversationid
          - created_at
          - id
          - image
          - image_path
          - isoutbound
          - msid
          - read
          - status
          - text
          - updated_at
          - userid
  select_permissions:
    - role: user
      permission:
        columns:
          - conversationid
          - created_at
          - id
          - image
          - image_path
          - isoutbound
          - msid
          - read
          - status
          - text
          - updated_at
          - userid
        filter:
          conversation:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - conversationid
          - created_at
          - id
          - image
          - image_path
          - isoutbound
          - msid
          - read
          - status
          - text
          - updated_at
        filter:
          conversation:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          conversation:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
- table:
    name: mixdata
    schema: public
  object_relationships:
    - name: job
      using:
        foreign_key_constraint_on: jobid
  insert_permissions:
    - role: user
      permission:
        check:
          job:
            bodyshop:
              associations:
                _and:
                  - active:
                      _eq: true
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
        columns:
          - mixdata
          - totalliquidcost
          - totalsundrycost
          - company
          - version
          - created_at
          - updated_at
          - id
          - jobid
  select_permissions:
    - role: user
      permission:
        columns:
          - mixdata
          - totalliquidcost
          - totalsundrycost
          - company
          - version
          - created_at
          - updated_at
          - id
          - jobid
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - active:
                      _eq: true
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
  update_permissions:
    - role: user
      permission:
        columns:
          - mixdata
          - totalliquidcost
          - totalsundrycost
          - company
          - version
          - created_at
          - updated_at
          - id
          - jobid
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - active:
                      _eq: true
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
        check: null
- table:
    name: notes
    schema: public
  object_relationships:
    - name: job
      using:
        foreign_key_constraint_on: jobid
    - name: user
      using:
        foreign_key_constraint_on: created_by
  insert_permissions:
    - role: user
      permission:
        check:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        columns:
          - audit
          - created_at
          - created_by
          - critical
          - id
          - jobid
          - private
          - text
          - type
          - updated_at
  select_permissions:
    - role: user
      permission:
        columns:
          - audit
          - created_at
          - created_by
          - critical
          - id
          - jobid
          - private
          - text
          - type
          - updated_at
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
  update_permissions:
    - role: user
      permission:
        columns:
          - audit
          - created_at
          - created_by
          - critical
          - id
          - jobid
          - private
          - text
          - type
          - updated_at
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
- table:
    name: owners
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: shopid
  array_relationships:
    - name: jobs
      using:
        foreign_key_constraint_on:
          column: ownerid
          table:
            name: jobs
            schema: public
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - accountingid
          - allow_text_message
          - created_at
          - id
          - note
          - ownr_addr1
          - ownr_addr2
          - ownr_city
          - ownr_co_nm
          - ownr_ctry
          - ownr_ea
          - ownr_fn
          - ownr_ln
          - ownr_ph1
          - ownr_ph2
          - ownr_st
          - ownr_title
          - ownr_zip
          - preferred_contact
          - shopid
          - updated_at
  select_permissions:
    - role: user
      permission:
        columns:
          - accountingid
          - allow_text_message
          - created_at
          - id
          - note
          - ownr_addr1
          - ownr_addr2
          - ownr_city
          - ownr_co_nm
          - ownr_ctry
          - ownr_ea
          - ownr_fn
          - ownr_ln
          - ownr_ph1
          - ownr_ph2
          - ownr_st
          - ownr_title
          - ownr_zip
          - preferred_contact
          - shopid
          - tax_number
          - updated_at
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - accountingid
          - allow_text_message
          - created_at
          - id
          - note
          - ownr_addr1
          - ownr_addr2
          - ownr_city
          - ownr_co_nm
          - ownr_ctry
          - ownr_ea
          - ownr_fn
          - ownr_ln
          - ownr_ph1
          - ownr_ph2
          - ownr_st
          - ownr_title
          - ownr_zip
          - preferred_contact
          - shopid
          - tax_number
          - updated_at
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
  event_triggers:
    - name: os_owners
      definition:
        delete:
          columns: '*'
        enable_manual: false
        insert:
          columns: '*'
        update:
          columns: '*'
      retry_conf:
        interval_sec: 10
        num_retries: 3
        timeout_sec: 60
      webhook_from_env: HASURA_API_URL
      headers:
        - name: event-secret
          value_from_env: EVENT_SECRET
      request_transform:
        method: POST
        query_params: {}
        template_engine: Kriti
        url: '{{$base_url}}/opensearch'
        version: 2
- table:
    name: parts_dispatch
    schema: public
  object_relationships:
    - name: job
      using:
        foreign_key_constraint_on: jobid
  array_relationships:
    - name: parts_dispatch_lines
      using:
        foreign_key_constraint_on:
          column: partsdispatchid
          table:
            name: parts_dispatch_lines
            schema: public
  insert_permissions:
    - role: user
      permission:
        check:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        columns:
          - id
          - created_at
          - updated_at
          - jobid
          - number
          - employeeid
          - dispatched_at
          - dispatched_by
  select_permissions:
    - role: user
      permission:
        columns:
          - number
          - dispatched_by
          - created_at
          - dispatched_at
          - updated_at
          - employeeid
          - id
          - jobid
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - number
          - dispatched_by
          - created_at
          - dispatched_at
          - updated_at
          - employeeid
          - id
          - jobid
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        check: null
- table:
    name: parts_dispatch_lines
    schema: public
  object_relationships:
    - name: jobline
      using:
        foreign_key_constraint_on: joblineid
    - name: parts_dispatch
      using:
        foreign_key_constraint_on: partsdispatchid
  insert_permissions:
    - role: user
      permission:
        check:
          parts_dispatch:
            job:
              bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
        columns:
          - id
          - created_at
          - updated_at
          - partsdispatchid
          - joblineid
          - quantity
          - accepted_at
  select_permissions:
    - role: user
      permission:
        columns:
          - quantity
          - accepted_at
          - created_at
          - updated_at
          - id
          - joblineid
          - partsdispatchid
        filter:
          parts_dispatch:
            job:
              bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - id
          - created_at
          - updated_at
          - partsdispatchid
          - joblineid
          - quantity
          - accepted_at
        filter:
          parts_dispatch:
            job:
              bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
        check: null
- table:
    name: parts_order_lines
    schema: public
  object_relationships:
    - name: jobline
      using:
        foreign_key_constraint_on: job_line_id
    - name: parts_order
      using:
        foreign_key_constraint_on: orderid
  insert_permissions:
    - role: user
      permission:
        check:
          parts_order:
            job:
              bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
        columns:
          - act_price
          - backordered_eta
          - backordered_on
          - cm_received
          - cost
          - created_at
          - db_price
          - id
          - job_line_id
          - line_desc
          - line_remarks
          - oem_partno
          - orderid
          - part_type
          - quantity
          - status
          - updated_at
  select_permissions:
    - role: user
      permission:
        columns:
          - act_price
          - backordered_eta
          - backordered_on
          - cm_received
          - cost
          - created_at
          - db_price
          - id
          - job_line_id
          - line_desc
          - line_remarks
          - oem_partno
          - orderid
          - part_type
          - quantity
          - status
          - updated_at
        filter:
          parts_order:
            job:
              bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
  update_permissions:
    - role: user
      permission:
        columns:
          - act_price
          - backordered_eta
          - backordered_on
          - cm_received
          - cost
          - created_at
          - db_price
          - id
          - job_line_id
          - line_desc
          - line_remarks
          - oem_partno
          - orderid
          - part_type
          - quantity
          - status
          - updated_at
        filter:
          parts_order:
            job:
              bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          parts_order:
            job:
              bodyshop:
                associations:
                  _and:
                    - user:
                        authid:
                          _eq: X-Hasura-User-Id
                    - active:
                        _eq: true
- table:
    name: parts_orders
    schema: public
  object_relationships:
    - name: bill
      using:
        foreign_key_constraint_on: returnfrombill
    - name: job
      using:
        foreign_key_constraint_on: jobid
    - name: user
      using:
        foreign_key_constraint_on: user_email
    - name: userByOrderedby
      using:
        foreign_key_constraint_on: orderedby
    - name: vendor
      using:
        foreign_key_constraint_on: vendorid
  array_relationships:
    - name: parts_order_lines
      using:
        foreign_key_constraint_on:
          column: orderid
          table:
            name: parts_order_lines
            schema: public
    - name: tasks
      using:
        foreign_key_constraint_on:
          column: partsorderid
          table:
            name: tasks
            schema: public
  insert_permissions:
    - role: user
      permission:
        check:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        columns:
          - comments
          - created_at
          - deliver_by
          - id
          - jobid
          - order_date
          - order_number
          - orderedby
          - return
          - returnfrombill
          - status
          - updated_at
          - user_email
          - vendorid
  select_permissions:
    - role: user
      permission:
        columns:
          - comments
          - created_at
          - deliver_by
          - id
          - jobid
          - order_date
          - order_number
          - orderedby
          - return
          - returnfrombill
          - status
          - updated_at
          - user_email
          - vendorid
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
  update_permissions:
    - role: user
      permission:
        columns:
          - comments
          - created_at
          - deliver_by
          - id
          - jobid
          - order_date
          - order_number
          - orderedby
          - returnfrombill
          - status
          - updated_at
          - user_email
          - vendorid
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
- table:
    name: payment_response
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
    - name: job
      using:
        foreign_key_constraint_on: jobid
    - name: payment
      using:
        foreign_key_constraint_on: paymentid
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - amount
          - bodyshopid
          - declinereason
          - ext_paymentid
          - jobid
          - paymentid
          - response
          - successful
  select_permissions:
    - role: user
      permission:
        columns:
          - successful
          - response
          - amount
          - declinereason
          - ext_paymentid
          - bodyshopid
          - id
          - jobid
          - paymentid
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        allow_aggregations: true
- table:
    name: payments
    schema: public
  object_relationships:
    - name: job
      using:
        foreign_key_constraint_on: jobid
  array_relationships:
    - name: exportlogs
      using:
        foreign_key_constraint_on:
          column: paymentid
          table:
            name: exportlog
            schema: public
    - name: payment_responses
      using:
        foreign_key_constraint_on:
          column: paymentid
          table:
            name: payment_response
            schema: public
  insert_permissions:
    - role: user
      permission:
        check:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        columns:
          - amount
          - created_at
          - date
          - exportedat
          - id
          - jobid
          - memo
          - payer
          - paymentnum
          - stripeid
          - transactionid
          - type
          - updated_at
  select_permissions:
    - role: user
      permission:
        columns:
          - amount
          - created_at
          - date
          - exportedat
          - id
          - jobid
          - memo
          - payer
          - paymentnum
          - stripeid
          - transactionid
          - type
          - updated_at
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - amount
          - created_at
          - date
          - exportedat
          - id
          - jobid
          - memo
          - payer
          - paymentnum
          - stripeid
          - transactionid
          - type
          - updated_at
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
  event_triggers:
    - name: os_payments
      definition:
        delete:
          columns: '*'
        enable_manual: false
        insert:
          columns: '*'
        update:
          columns: '*'
      retry_conf:
        interval_sec: 10
        num_retries: 3
        timeout_sec: 60
      webhook_from_env: HASURA_API_URL
      headers:
        - name: event-secret
          value_from_env: EVENT_SECRET
      request_transform:
        method: POST
        query_params: {}
        template_engine: Kriti
        url: '{{$base_url}}/opensearch'
        version: 2
- table:
    name: phonebook
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - id
          - created_at
          - updated_at
          - bodyshopid
          - firstname
          - lastname
          - phone1
          - email
          - address1
          - address2
          - city
          - state
          - zip
          - country
          - company
          - phone2
          - fax
          - category
  select_permissions:
    - role: user
      permission:
        columns:
          - address1
          - address2
          - category
          - city
          - company
          - country
          - email
          - fax
          - firstname
          - lastname
          - phone1
          - phone2
          - state
          - zip
          - created_at
          - updated_at
          - bodyshopid
          - id
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - address1
          - address2
          - category
          - city
          - company
          - country
          - email
          - fax
          - firstname
          - lastname
          - phone1
          - phone2
          - state
          - zip
          - created_at
          - updated_at
          - bodyshopid
          - id
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
- table:
    name: relatedjobs
    schema: public
  object_relationships:
    - name: childjob_rel
      using:
        foreign_key_constraint_on: childjob
    - name: parentjob_rel
      using:
        foreign_key_constraint_on: parentjob
  insert_permissions:
    - role: user
      permission:
        check:
          _or:
            - parentjob_rel:
                bodyshop:
                  associations:
                    _and:
                      - user:
                          authid:
                            _eq: X-Hasura-User-Id
                      - active:
                          _eq: true
            - childjob_rel:
                bodyshop:
                  associations:
                    _and:
                      - user:
                          authid:
                            _eq: X-Hasura-User-Id
                      - active:
                          _eq: true
        columns:
          - id
          - created_at
          - updated_at
          - parentjob
          - childjob
  select_permissions:
    - role: user
      permission:
        columns:
          - created_at
          - updated_at
          - childjob
          - id
          - parentjob
        filter:
          _or:
            - parentjob_rel:
                bodyshop:
                  associations:
                    _and:
                      - user:
                          authid:
                            _eq: X-Hasura-User-Id
                      - active:
                          _eq: true
            - childjob_rel:
                bodyshop:
                  associations:
                    _and:
                      - user:
                          authid:
                            _eq: X-Hasura-User-Id
                      - active:
                          _eq: true
  update_permissions:
    - role: user
      permission:
        columns:
          - created_at
          - updated_at
          - childjob
          - id
          - parentjob
        filter:
          _or:
            - parentjob_rel:
                bodyshop:
                  associations:
                    _and:
                      - user:
                          authid:
                            _eq: X-Hasura-User-Id
                      - active:
                          _eq: true
            - childjob_rel:
                bodyshop:
                  associations:
                    _and:
                      - user:
                          authid:
                            _eq: X-Hasura-User-Id
                      - active:
                          _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          _or:
            - parentjob_rel:
                bodyshop:
                  associations:
                    _and:
                      - user:
                          authid:
                            _eq: X-Hasura-User-Id
                      - active:
                          _eq: true
            - childjob_rel:
                bodyshop:
                  associations:
                    _and:
                      - user:
                          authid:
                            _eq: X-Hasura-User-Id
                      - active:
                          _eq: true
- table:
    name: scoreboard
    schema: public
  object_relationships:
    - name: job
      using:
        foreign_key_constraint_on: jobid
  insert_permissions:
    - role: user
      permission:
        check:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        columns:
          - id
          - jobid
          - painthrs
          - bodyhrs
          - date
  select_permissions:
    - role: user
      permission:
        columns:
          - date
          - bodyhrs
          - painthrs
          - id
          - jobid
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - date
          - bodyhrs
          - painthrs
          - id
          - jobid
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          job:
            bodyshop:
              associations:
                _and:
                  - user:
                      authid:
                        _eq: X-Hasura-User-Id
                  - active:
                      _eq: true
- table:
    name: tasks
    schema: public
  object_relationships:
    - name: assigned_to_employee
      using:
        foreign_key_constraint_on: assigned_to
    - name: bill
      using:
        foreign_key_constraint_on: billid
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
    - name: job
      using:
        foreign_key_constraint_on: jobid
    - name: jobline
      using:
        foreign_key_constraint_on: joblineid
    - name: parts_order
      using:
        foreign_key_constraint_on: partsorderid
    - name: userByCreatedBy
      using:
        foreign_key_constraint_on: created_by
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - assigned_to
          - billid
          - bodyshopid
          - completed
          - completed_at
          - created_at
          - created_by
          - deleted
          - deleted_at
          - description
          - due_date
          - id
          - jobid
          - joblineid
          - partsorderid
          - priority
          - remind_at
          - remind_at_sent
          - title
          - updated_at
  select_permissions:
    - role: user
      permission:
        columns:
          - assigned_to
          - billid
          - bodyshopid
          - completed
          - completed_at
          - created_at
          - created_by
          - deleted
          - deleted_at
          - description
          - due_date
          - id
          - jobid
          - joblineid
          - partsorderid
          - priority
          - remind_at
          - remind_at_sent
          - title
          - updated_at
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - assigned_to
          - billid
          - bodyshopid
          - completed
          - completed_at
          - created_at
          - created_by
          - deleted
          - deleted_at
          - description
          - due_date
          - id
          - jobid
          - joblineid
          - partsorderid
          - priority
          - remind_at
          - remind_at_sent
          - title
          - updated_at
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        check: null
  event_triggers:
    - name: tasks_assigned_changed
      definition:
        enable_manual: false
        insert:
          columns: '*'
        update:
          columns:
            - assigned_to
      retry_conf:
        interval_sec: 10
        num_retries: 3
        timeout_sec: 60
      webhook_from_env: HASURA_API_URL
      headers:
        - name: event-secret
          value_from_env: EVENT_SECRET
      request_transform:
        method: POST
        query_params: {}
        template_engine: Kriti
        url: '{{$base_url}}/tasks-assigned-handler'
        version: 2
- table:
    name: timetickets
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
    - name: employee
      using:
        foreign_key_constraint_on: employeeid
    - name: job
      using:
        foreign_key_constraint_on: jobid
    - name: tt_approval_queue
      using:
        foreign_key_constraint_on: ttapprovalqueueid
    - name: user
      using:
        foreign_key_constraint_on: commited_by
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - actualhrs
          - bodyshopid
          - ciecacode
          - clockoff
          - clockon
          - commited_by
          - committed_at
          - cost_center
          - created_at
          - created_by
          - date
          - employeeid
          - flat_rate
          - id
          - jobid
          - memo
          - productivehrs
          - rate
          - task_name
          - ttapprovalqueueid
          - updated_at
  select_permissions:
    - role: user
      permission:
        columns:
          - actualhrs
          - bodyshopid
          - ciecacode
          - clockoff
          - clockon
          - commited_by
          - committed_at
          - cost_center
          - created_at
          - created_by
          - date
          - employeeid
          - flat_rate
          - id
          - jobid
          - memo
          - productivehrs
          - rate
          - task_name
          - ttapprovalqueueid
          - updated_at
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
  update_permissions:
    - role: user
      permission:
        columns:
          - actualhrs
          - bodyshopid
          - ciecacode
          - clockoff
          - clockon
          - commited_by
          - committed_at
          - cost_center
          - created_at
          - created_by
          - date
          - employeeid
          - flat_rate
          - id
          - jobid
          - memo
          - productivehrs
          - rate
          - task_name
          - ttapprovalqueueid
          - updated_at
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
- table:
    name: transitions
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
    - name: job
      using:
        foreign_key_constraint_on: jobid
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - active:
                    _eq: true
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
        columns:
          - bodyshopid
          - created_at
          - duration
          - end
          - id
          - jobid
          - next_value
          - prev_value
          - start
          - type
          - updated_at
          - value
  select_permissions:
    - role: user
      permission:
        columns:
          - duration
          - next_value
          - prev_value
          - type
          - value
          - created_at
          - end
          - start
          - updated_at
          - bodyshopid
          - id
          - jobid
        filter:
          bodyshop:
            associations:
              _and:
                - active:
                    _eq: true
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
  update_permissions:
    - role: user
      permission:
        columns:
          - duration
          - next_value
          - prev_value
          - type
          - value
          - created_at
          - end
          - start
          - updated_at
          - bodyshopid
          - id
          - jobid
        filter:
          bodyshop:
            associations:
              _and:
                - active:
                    _eq: true
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
        check: {}
- table:
    name: tt_approval_queue
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
    - name: employee
      using:
        foreign_key_constraint_on: employeeid
    - name: job
      using:
        foreign_key_constraint_on: jobid
    - name: user
      using:
        foreign_key_constraint_on: approved_by
  array_relationships:
    - name: timetickets
      using:
        foreign_key_constraint_on:
          column: ttapprovalqueueid
          table:
            name: timetickets
            schema: public
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - active:
                    _eq: true
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
        columns:
          - actualhrs
          - approved_at
          - approved_by
          - bodyshopid
          - ciecacode
          - cost_center
          - created_at
          - date
          - employeeid
          - flat_rate
          - id
          - jobid
          - memo
          - productivehrs
          - rate
          - updated_at
  select_permissions:
    - role: user
      permission:
        columns:
          - actualhrs
          - approved_at
          - approved_by
          - bodyshopid
          - ciecacode
          - cost_center
          - created_at
          - date
          - employeeid
          - flat_rate
          - id
          - jobid
          - memo
          - productivehrs
          - rate
          - updated_at
        filter:
          bodyshop:
            associations:
              _and:
                - active:
                    _eq: true
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - actualhrs
          - approved_at
          - approved_by
          - bodyshopid
          - ciecacode
          - cost_center
          - created_at
          - date
          - employeeid
          - flat_rate
          - id
          - jobid
          - memo
          - productivehrs
          - rate
          - updated_at
        filter:
          bodyshop:
            associations:
              _and:
                - active:
                    _eq: true
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
        check: null
- table:
    name: users
    schema: public
  object_relationships:
    - name: employee
      using:
        manual_configuration:
          column_mapping:
            email: user_email
          insertion_order: null
          remote_table:
            name: employees
            schema: public
  array_relationships:
    - name: associations
      using:
        foreign_key_constraint_on:
          column: useremail
          table:
            name: associations
            schema: public
    - name: audit_trails
      using:
        foreign_key_constraint_on:
          column: useremail
          table:
            name: audit_trail
            schema: public
    - name: email_audit_trails
      using:
        foreign_key_constraint_on:
          column: useremail
          table:
            name: email_audit_trail
            schema: public
    - name: employees
      using:
        foreign_key_constraint_on:
          column: user_email
          table:
            name: employees
            schema: public
    - name: eula_acceptances
      using:
        foreign_key_constraint_on:
          column: useremail
          table:
            name: eula_acceptances
            schema: public
    - name: exportlogs
      using:
        foreign_key_constraint_on:
          column: useremail
          table:
            name: exportlog
            schema: public
    - name: ioevents
      using:
        foreign_key_constraint_on:
          column: useremail
          table:
            name: ioevents
            schema: public
    - name: messages
      using:
        foreign_key_constraint_on:
          column: userid
          table:
            name: messages
            schema: public
    - name: notes
      using:
        foreign_key_constraint_on:
          column: created_by
          table:
            name: notes
            schema: public
    - name: partsOrdersByOrderedby
      using:
        foreign_key_constraint_on:
          column: orderedby
          table:
            name: parts_orders
            schema: public
    - name: parts_orders
      using:
        foreign_key_constraint_on:
          column: user_email
          table:
            name: parts_orders
            schema: public
    - name: tasksByCreatedBy
      using:
        foreign_key_constraint_on:
          column: created_by
          table:
            name: tasks
            schema: public
    - name: timetickets
      using:
        foreign_key_constraint_on:
          column: commited_by
          table:
            name: timetickets
            schema: public
    - name: tt_approval_queues
      using:
        foreign_key_constraint_on:
          column: approved_by
          table:
            name: tt_approval_queue
            schema: public
  insert_permissions:
    - role: user
      permission:
        check: {}
        columns:
          - authid
          - email
          - fcmtokens
          - validemail
  select_permissions:
    - role: user
      permission:
        columns:
          - authid
          - created_at
          - dashboardlayout
          - email
          - fcmtokens
          - updated_at
          - validemail
        filter:
          associations:
            bodyshop:
              associations:
                active:
                  _eq: true
  update_permissions:
    - role: user
      permission:
        columns:
          - authid
          - dashboardlayout
          - email
          - fcmtokens
        filter:
          authid:
            _eq: X-Hasura-User-Id
        check: null
- table:
    name: vehicles
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: shopid
  array_relationships:
    - name: jobs
      using:
        foreign_key_constraint_on:
          column: vehicleid
          table:
            name: jobs
            schema: public
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - created_at
          - db_v_code
          - id
          - notes
          - plate_no
          - plate_st
          - shopid
          - trim_color
          - updated_at
          - v_bstyle
          - v_color
          - v_cond
          - v_engine
          - v_make_desc
          - v_makecode
          - v_mldgcode
          - v_model_desc
          - v_model_yr
          - v_options
          - v_paint_codes
          - v_prod_dt
          - v_stage
          - v_tone
          - v_trimcode
          - v_type
          - v_vin
  select_permissions:
    - role: user
      permission:
        columns:
          - created_at
          - db_v_code
          - id
          - notes
          - plate_no
          - plate_st
          - shopid
          - trim_color
          - updated_at
          - v_bstyle
          - v_color
          - v_cond
          - v_engine
          - v_make_desc
          - v_makecode
          - v_mldgcode
          - v_model_desc
          - v_model_yr
          - v_options
          - v_paint_codes
          - v_prod_dt
          - v_stage
          - v_tone
          - v_trimcode
          - v_type
          - v_vin
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - created_at
          - db_v_code
          - id
          - notes
          - plate_no
          - plate_st
          - shopid
          - trim_color
          - updated_at
          - v_bstyle
          - v_color
          - v_cond
          - v_engine
          - v_make_desc
          - v_makecode
          - v_mldgcode
          - v_model_desc
          - v_model_yr
          - v_options
          - v_paint_codes
          - v_prod_dt
          - v_stage
          - v_tone
          - v_trimcode
          - v_type
          - v_vin
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
  event_triggers:
    - name: os_vehicles
      definition:
        delete:
          columns: '*'
        enable_manual: false
        insert:
          columns: '*'
        update:
          columns: '*'
      retry_conf:
        interval_sec: 10
        num_retries: 3
        timeout_sec: 60
      webhook_from_env: HASURA_API_URL
      headers:
        - name: event-secret
          value_from_env: EVENT_SECRET
      request_transform:
        method: POST
        query_params: {}
        template_engine: Kriti
        url: '{{$base_url}}/opensearch'
        version: 2
- table:
    name: vendors
    schema: public
  object_relationships:
    - name: bodyshop
      using:
        foreign_key_constraint_on: bodyshopid
  array_relationships:
    - name: invoices
      using:
        foreign_key_constraint_on:
          column: vendorid
          table:
            name: bills
            schema: public
    - name: parts_orders
      using:
        foreign_key_constraint_on:
          column: vendorid
          table:
            name: parts_orders
            schema: public
  insert_permissions:
    - role: user
      permission:
        check:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        columns:
          - active
          - bodyshopid
          - city
          - cost_center
          - country
          - created_at
          - discount
          - dmsid
          - due_date
          - email
          - favorite
          - id
          - name
          - phone
          - state
          - street1
          - street2
          - updated_at
          - zip
  select_permissions:
    - role: user
      permission:
        columns:
          - active
          - bodyshopid
          - city
          - cost_center
          - country
          - created_at
          - discount
          - dmsid
          - due_date
          - email
          - favorite
          - id
          - name
          - phone
          - state
          - street1
          - street2
          - updated_at
          - zip
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        allow_aggregations: true
  update_permissions:
    - role: user
      permission:
        columns:
          - active
          - bodyshopid
          - city
          - cost_center
          - country
          - created_at
          - discount
          - dmsid
          - due_date
          - email
          - favorite
          - id
          - name
          - phone
          - state
          - street1
          - street2
          - updated_at
          - zip
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
        check: null
  delete_permissions:
    - role: user
      permission:
        backend_only: false
        filter:
          bodyshop:
            associations:
              _and:
                - user:
                    authid:
                      _eq: X-Hasura-User-Id
                - active:
                    _eq: true
