diff --git a/.github/workflows/lint-untyped-from.yml b/.github/workflows/lint-untyped-from.yml index 7c70ba575..c991b3516 100644 --- a/.github/workflows/lint-untyped-from.yml +++ b/.github/workflows/lint-untyped-from.yml @@ -1 +1,40 @@ -IyBMaW50OiBjcnV6YSBjaGFtYWRhcyB1bnR5cGVkRnJvbSgiWCIpIG5vIHNyYy8gY29udHJhIG8gc2NoZW1hIGdlcmFkbwojIGVtIHNyYy9pbnRlZ3JhdGlvbnMvc3VwYWJhc2UvdHlwZXMudHMuIEV4aXN0ZSBwcmEgZXZpdGFyIGEgcmVncmVzc8OjbwojIGRvIGNvbGFwc28gZGUgMjAyNi0wNS0yNCwgcXVhbmRvIHRhYmVsYXMgaW5leGlzdGVudGVzIG5vIGJhbmNvIGVyYW0KIyBjaGFtYWRhcyBlIHF1ZWJyYXZhbSBmZWF0dXJlcyBlbSBzaWzDqm5jaW8gKGNhdGNoIHsgcmV0dXJuIFtdOyB9KS4KIwojIEVzdGFkbzogYWR2aXNvcnkgKGNvbnRpbnVlLW9uLWVycm9yKSBhdMOpIHR5cGVzLnRzIHNlciByZWdlbmVyYWRvCiMgYXDDs3MgUFJzICMzMTUgZSAjMzE3LiBRdWFuZG8gbyBidWlsZCB2b2x0YXIgYSBwYXNzYXIsIHJlbW92YSBvCiMgY29udGludWUtb24tZXJyb3IgcHJhIHRvcm5hciBlc3RlIGNoZWNrIHJlcXVpcmVkLgoKbmFtZTogTGludCB1bnR5cGVkRnJvbQoKb246CiAgcHVsbF9yZXF1ZXN0OgogICAgcGF0aHM6CiAgICAgIC0gJ3NyYy8qKi8qLnRzJwogICAgICAtICdzcmMvKiovKi50c3gnCiAgICAgIC0gJ3NjcmlwdHMvbGludC11bnR5cGVkLWZyb20uc2gnCiAgICAgIC0gJy5naXRodWIvd29ya2Zsb3dzL2xpbnQtdW50eXBlZC1mcm9tLnltbCcKICBwdXNoOgogICAgYnJhbmNoZXM6IFttYWluXQogIHdvcmtmbG93X2Rpc3BhdGNoOgoKcGVybWlzc2lvbnM6CiAgY29udGVudHM6IHJlYWQKCmNvbmN1cnJlbmN5OgogIGdyb3VwOiBsaW50LXVudHlwZWQtZnJvbS0ke3sgZ2l0aHViLnJlZiB9fQogIGNhbmNlbC1pbi1wcm9ncmVzczogdHJ1ZQoKam9iczoKICBsaW50OgogICAgbmFtZTogQ3J1emEgdW50eXBlZEZyb20gw5cgdHlwZXMudHMKICAgIHJ1bnMtb246IHVidW50dS1sYXRlc3QKICAgIHRpbWVvdXQtbWludXRlczogMgogICAgIyBUT0RPKEBhZG0wMS1kZWJ1Zyk6IHJlbW92ZXIgY29udGludWUtb24tZXJyb3IgYXDDs3MgcmVnZW5lcmFyCiAgICAjIHNyYy9pbnRlZ3JhdGlvbnMvc3VwYWJhc2UvdHlwZXMudHMgKHN1cGFiYXNlIGdlbiB0eXBlcyB0eXBlc2NyaXB0KQogICAgIyBwYXJhIHF1ZSBvIGxpbnQgcGFzc2UgbmF0dXJhbG1lbnRlLiBBIHBhcnRpciBkYcOtLCBxdWFscXVlcgogICAgIyB1bnR5cGVkRnJvbSgpIGFwb250YW5kbyBwYXJhIHRhYmVsYSBmYWx0YW50ZSBibG9xdWVpYSBvIFBSLgogICAgY29udGludWUtb24tZXJyb3I6IHRydWUKICAgIHN0ZXBzOgogICAgICAtIG5hbWU6IENoZWNrb3V0CiAgICAgICAgdXNlczogYWN0aW9ucy9jaGVja291dEB2NQoKICAgICAgLSBuYW1lOiBSdW4gbGludAogICAgICAgIHJ1bjogYmFzaCBzY3JpcHRzL2xpbnQtdW50eXBlZC1mcm9tLnNoCg== \ No newline at end of file +# Lint: cruza chamadas untypedFrom("X") no src/ contra o schema gerado +# em src/integrations/supabase/types.ts. Existe pra evitar a regressão +# do colapso de 2026-05-24, quando tabelas inexistentes no banco eram +# chamadas e quebravam features em silêncio (catch { return []; }). +# +# Estado: required. types.ts foi regenerado a partir do schema ao vivo, +# então o lint passa naturalmente. Qualquer untypedFrom() apontando para +# tabela faltante no schema gerado bloqueia o PR. + +name: Lint untypedFrom + +on: + pull_request: + paths: + - 'src/**/*.ts' + - 'src/**/*.tsx' + - 'scripts/lint-untyped-from.sh' + - '.github/workflows/lint-untyped-from.yml' + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: lint-untyped-from-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + name: Cruza untypedFrom × types.ts + runs-on: ubuntu-latest + timeout-minutes: 2 + steps: + - name: Checkout + uses: actions/checkout@v5 + + - name: Run lint + run: bash scripts/lint-untyped-from.sh diff --git a/.tsc-baseline.json b/.tsc-baseline.json index a5fd947fc..722c62994 100644 --- a/.tsc-baseline.json +++ b/.tsc-baseline.json @@ -1,13 +1,41 @@ { - "generatedAt": "2026-05-24T19:40:05.304Z", - "totalErrors": 508, + "generatedAt": "2026-05-25T00:45:16.132Z", + "totalErrors": 545, "counts": { + "src/components/admin/SellerDiscountLimitsPanel.tsx": { + "TS2322": 1, + "TS2345": 1 + }, "src/components/admin/products/BulkImportDialog.tsx": { "TS2322": 1 }, "src/components/admin/products/ProductFormFullscreen.tsx": { "TS2352": 1 }, + "src/components/admin/security/ActiveIpsList.tsx": { + "TS2345": 1 + }, + "src/components/admin/security/RecentAuditTable.tsx": { + "TS2538": 1 + }, + "src/components/admin/security/keys/audit/useMcpAuditFeed.ts": { + "TS2345": 1 + }, + "src/components/admin/security/keys/audit/useStepUpAttempts.ts": { + "TS2538": 1 + }, + "src/components/admin/security/keys/useMcpKeys.ts": { + "TS2345": 1 + }, + "src/components/admin/security/role-migration/RoleMigrationPanel.tsx": { + "TS2345": 2 + }, + "src/components/admin/users/RoleAuditLogPanel.tsx": { + "TS2345": 1 + }, + "src/components/admin/users/useUserManagement.ts": { + "TS2322": 1 + }, "src/components/catalog/CatalogContent.tsx": { "TS2322": 1, "TS2741": 1 @@ -38,6 +66,16 @@ "TS2339": 1, "TS7006": 5 }, + "src/components/dashboard/MyClientsWidget.tsx": { + "TS2345": 1 + }, + "src/components/dashboard/MyRecentQuotesWidget.tsx": { + "TS2538": 1, + "TS2769": 1 + }, + "src/components/dashboard/RecentKitsWidget.tsx": { + "TS2345": 1 + }, "src/components/dev/BridgeMetricsOverlay.tsx": { "TS4104": 1 }, @@ -55,17 +93,19 @@ "TS2322": 1 }, "src/components/expert/chat/useExpertChat.ts": { - "TS1345": 2 + "TS1345": 2, + "TS2322": 1 }, "src/components/favorites/FavoritesTrashView.tsx": { - "TS2322": 1 + "TS2322": 1, + "TS2345": 1 }, "src/components/filters/ExternalCategoryFilter.tsx": { "TS2345": 1 }, "src/components/filters/FilterPresets.ts": { - "TS2322": 1, - "TS2345": 1 + "TS2322": 9, + "TS2345": 2 }, "src/components/filters/filter-panel/useFilterPanelState.ts": { "TS2339": 2 @@ -257,7 +297,7 @@ "TS2339": 1 }, "src/components/search/useGlobalSearch.ts": { - "TS2322": 2, + "TS2322": 3, "TS2339": 6, "TS2345": 3, "TS2352": 6, @@ -266,6 +306,9 @@ "src/components/security/MfaEnrollmentDialog.tsx": { "TS2367": 1 }, + "src/components/security/SecurityDashboard.tsx": { + "TS2345": 1 + }, "src/components/simulator/MockupPreview.tsx": { "TS2339": 13, "TS2551": 3 @@ -374,6 +417,14 @@ "src/hooks/intelligence/useMagicUpGeneration.ts": { "TS2322": 1 }, + "src/hooks/intelligence/useSalesHistory.ts": { + "TS2322": 4, + "TS2538": 1 + }, + "src/hooks/intelligence/useSalesHistoryMacro.ts": { + "TS2322": 2, + "TS2538": 1 + }, "src/hooks/intelligence/useScheduledReports.ts": { "TS2322": 1 }, @@ -389,16 +440,15 @@ "src/hooks/kit-builder/useKitBuilderTransformers.ts": { "TS2345": 4 }, + "src/hooks/kit-builder/useKitCollaboration.ts": { + "TS2322": 1 + }, "src/hooks/kit-builder/useKitTemplates.ts": { "TS2322": 3 }, "src/hooks/mockup/mockupGenerationService.ts": { "TS2345": 1 }, - "src/hooks/mockup/useMockupDraft.ts": { - "TS2345": 2, - "TS2769": 2 - }, "src/hooks/mockup/useMockupGenerator.ts": { "TS2339": 2, "TS2345": 1 @@ -416,18 +466,12 @@ "src/hooks/products/useColorEnrichment.ts": { "TS2322": 1 }, - "src/hooks/products/useColorSystem.ts": { - "TS2345": 1, - "TS2352": 1, - "TS2769": 1 - }, "src/hooks/products/useNoveltiesSelectionMode.ts": { "TS2352": 1 }, "src/hooks/products/useProductInsights.ts": { - "TS18047": 1, - "TS2345": 1, - "TS2531": 1 + "TS2322": 1, + "TS2345": 1 }, "src/hooks/products/useProductIntelligenceBadges.ts": { "TS2339": 7, @@ -442,9 +486,15 @@ "src/hooks/products/useSupplierFiscalData.ts": { "TS2352": 2 }, + "src/hooks/quotes/quoteHelpers.ts": { + "TS2322": 3 + }, "src/hooks/quotes/useAutoSaveQuote.ts": { "TS2339": 2 }, + "src/hooks/quotes/useDiscountApproval.ts": { + "TS2322": 1 + }, "src/hooks/quotes/useQuoteComments.ts": { "TS2322": 3, "TS2353": 1 @@ -455,6 +505,12 @@ "src/hooks/quotes/useQuoteHistory.ts": { "TS2345": 1 }, + "src/hooks/quotes/useQuoteTemplates.ts": { + "TS2345": 1 + }, + "src/hooks/quotes/useQuoteVersions.ts": { + "TS2322": 1 + }, "src/hooks/simulation/simulationClipboard.ts": { "TS2339": 26, "TS2551": 2 @@ -475,10 +531,9 @@ }, "src/hooks/simulation/useSimulation.ts": { "TS2339": 15, - "TS2345": 3, + "TS2345": 2, + "TS2352": 1, "TS2561": 1, - "TS2589": 1, - "TS2769": 3, "TS7006": 2 }, "src/hooks/simulation/useSimulatorPreferences.ts": { @@ -517,6 +572,9 @@ "src/lib/crm-db.ts": { "TS2322": 1 }, + "src/lib/external-db/__tests__/kill-switch-client.test.ts": { + "TS2556": 1 + }, "src/lib/external-db/batch-import.ts": { "TS2352": 2 }, @@ -525,7 +583,7 @@ }, "src/lib/external-db/invoke.ts": { "TS2322": 1, - "TS2353": 3 + "TS2353": 5 }, "src/lib/kit-builder/types.ts": { "TS18048": 2 @@ -546,6 +604,9 @@ "src/pages/SidebarQAPage.tsx": { "TS2322": 1 }, + "src/pages/admin/AdminSegurancaAcessoPage.tsx": { + "TS2345": 1 + }, "src/pages/admin/DevChallengeExamplesPage.tsx": { "TS2322": 1 }, @@ -556,6 +617,10 @@ "TS18046": 2, "TS2345": 1 }, + "src/pages/admin/SellerDiscountLimitsAdminPage.tsx": { + "TS2322": 1, + "TS2345": 2 + }, "src/pages/admin/telemetry/useOptimizationQueue.ts": { "TS2339": 1 }, @@ -576,9 +641,9 @@ "TS2345": 2 }, "src/pages/kit-builder/useKitBuilderQuote.ts": { + "TS1360": 1, "TS2305": 1, - "TS2345": 2, - "TS2353": 1 + "TS2345": 3 }, "src/pages/magic-up/MagicUpConfigPanel.tsx": { "TS2322": 1, @@ -612,10 +677,6 @@ "src/pages/quotes/QuoteBuilderPage.tsx": { "TS2339": 1 }, - "src/pages/quotes/QuotesKanbanPage.tsx": { - "TS2345": 1, - "TS2769": 1 - }, "src/pages/quotes/QuotesListPage.tsx": { "TS2345": 1, "TS2554": 1 diff --git a/scripts/lint-untyped-from.sh b/scripts/lint-untyped-from.sh old mode 100644 new mode 100755 index 2e2f18430..ef0b58b5a --- a/scripts/lint-untyped-from.sh +++ b/scripts/lint-untyped-from.sh @@ -1 +1,94 @@ -IyEvdXNyL2Jpbi9lbnYgYmFzaAojIExpbnQ6IGNydXphIG5vbWVzIGRlIHRhYmVsYSBjaGFtYWRvcyB2aWEgdW50eXBlZEZyb20oIi4uLiIpIGNvbnRyYSBvCiMgc2NoZW1hIGdlcmFkbyBlbSBzcmMvaW50ZWdyYXRpb25zL3N1cGFiYXNlL3R5cGVzLnRzLiBGYWxoYSBzZSBob3V2ZXIKIyB0YWJlbGEgZW0gdW50eXBlZEZyb20oKSBxdWUgTsODTyBhcGFyZWNlIG5vIHR5cGVzLnRzLgojCiMgT3JpZ2VtOiBvIGNvbGFwc28gZGUgMjAyNi0wNS0yNCAoUFJzICMzMTUgZSAjMzE3KSBmb2kgY2F1c2FkbyBwb3IgMTQKIyB0YWJlbGFzIGNoYW1hZGFzIHZpYSB1bnR5cGVkRnJvbSgpIHF1ZSBuw6NvIGV4aXN0aWFtIG5vIGJhbmNvLiBPIGZyb250CiMgdGVtIGBjYXRjaCB7IHJldHVybiBbXTsgfWAgZW0gY2FkYSBjaGFtYWRhLCBlbnTDo28gZmVhdHVyZXMgcXVlYnJhdmFtCiMgZW0gc2lsw6puY2lvLiBFc3RlIGxpbnQgZXZpdGEgYSByZWdyZXNzw6NvLgojCiMgUG9zc8OtdmVpcyBmYWxoYXM6CiMgICAxLiBBIHRhYmVsYSBuw6NvIGV4aXN0ZSBubyBiYW5jbyDihpIgY3JpYXIgbWlncmF0aW9uIHF1ZSBhIHJlc3RhdXJlLgojICAgMi4gZGF0YWJhc2UudHlwZXMudHMgZXN0w6EgZGVzYXR1YWxpemFkbyDihpIgcm9kYXIgYHN1cGFiYXNlIGdlbiB0eXBlc2AuCiMKIyBVc28gbG9jYWw6IC4vc2NyaXB0cy9saW50LXVudHlwZWQtZnJvbS5zaAojIFVzbyBDSTogICAgLmdpdGh1Yi93b3JrZmxvd3MvbGludC11bnR5cGVkLWZyb20ueW1sCgpzZXQgLWV1byBwaXBlZmFpbAoKUkVQT19ST09UPSIkezE6LSQoZ2l0IHJldi1wYXJzZSAtLXNob3ctdG9wbGV2ZWwgMj4vZGV2L251bGwgfHwgcHdkKX0iClRZUEVTX0ZJTEU9IiRSRVBPX1JPT1Qvc3JjL2ludGVncmF0aW9ucy9zdXBhYmFzZS90eXBlcy50cyIKU1JDX0RJUj0iJFJFUE9fUk9PVC9zcmMiCkRFRl9GSUxFPSJzcmMvbGliL3N1cGFiYXNlLXVudHlwZWQudHMiCgppZiBbWyAhIC1mICIkVFlQRVNfRklMRSIgXV07IHRoZW4KICBlY2hvICI6OmVycm9yOjp0eXBlcy50cyBuw6NvIGVuY29udHJhZG8gZW0gJFRZUEVTX0ZJTEUiCiAgZWNobyAiUm9kZSAnc3VwYWJhc2UgZ2VuIHR5cGVzIHR5cGVzY3JpcHQgLS1wcm9qZWN0LWlkIDxpZD4gPiAkVFlQRVNfRklMRScgYW50ZXMuIgogIGV4aXQgMgpmaQoKaWYgW1sgISAtZCAiJFNSQ19ESVIiIF1dOyB0aGVuCiAgZWNobyAiOjplcnJvcjo6ZGlyZXTDs3JpbyBzcmMvIG7Do28gZW5jb250cmFkbyBlbSAkU1JDX0RJUiIKICBleGl0IDIKZmkKCnRtcF9jYWxsZWQ9JChta3RlbXApCnRtcF9zY2hlbWE9JChta3RlbXApCnRtcF9taXNzaW5nPSQobWt0ZW1wKQp0cmFwICdybSAtZiAiJHRtcF9jYWxsZWQiICIkdG1wX3NjaGVtYSIgIiR0bXBfbWlzc2luZyInIEVYSVQKCiMgMSkgVGFiZWxhcyBjaGFtYWRhcyB2aWEgdW50eXBlZEZyb20oIi4uLiIpIG91IHVudHlwZWRGcm9tKCcuLi4nKSBlbSBzcmMvCiMgICAgKGV4Y2x1aSBhIHByw7NwcmlhIGRlZmluacOnw6NvIGVtIHN1cGFiYXNlLXVudHlwZWQudHMpCmdyZXAgLXJoRSAidW50eXBlZEZyb21bXihdKlwoWydcIl0oW2Etel9dW2EtejAtOV9dKilbJ1wiXSIgIiRTUkNfRElSIiBcCiAgICAtLWluY2x1ZGU9JyoudHMnIC0taW5jbHVkZT0nKi50c3gnIC0tZXhjbHVkZT0nc3VwYWJhc2UtdW50eXBlZC50cycgMj4vZGV2L251bGwgXAogIHwgc2VkIC1FICJzLy4qdW50eXBlZEZyb21bXihdKlwoWydcIl0oW2Etel9dW2EtejAtOV9dKylbJ1wiXS4qL1wxLyIgXAogIHwgc29ydCAtdSA+ICIkdG1wX2NhbGxlZCIgfHwgdHJ1ZQoKIyAyKSBOb21lcyBkZSB0YWJlbGEgbm8gdHlwZXMudHMgZ2VyYWRvLgojICAgIEVzdHJ1dHVyYTogZGVudHJvIGRlIGBUYWJsZXM6IHtgLCBjYWRhIGNoYXZlIMOpIHVtYSB0YWJlbGEgY29tIDYKIyAgICBlc3Bhw6dvcyBkZSBpbmRlbnRhw6fDo28gc2VndWlkYSBkZSBgOiB7YC4KZ3JlcCAtRSAnXiAgICAgIFthLXpfXVthLXowLTlfXSs6IFx7JCcgIiRUWVBFU19GSUxFIiBcCiAgfCBzZWQgLUUgJ3MvXiAgICAgIChbYS16X11bYS16MC05X10rKTouKi9cMS8nIFwKICB8IHNvcnQgLXUgPiAiJHRtcF9zY2hlbWEiCgpjYWxsZWRfY291bnQ9JCh3YyAtbCA8ICIkdG1wX2NhbGxlZCIgfCB0ciAtZCAnICcpCnNjaGVtYV9jb3VudD0kKHdjIC1sIDwgIiR0bXBfc2NoZW1hIiB8IHRyIC1kICcgJykKCmVjaG8gIj09PSBsaW50LXVudHlwZWQtZnJvbSA9PT0iCmVjaG8gIlRhYmVsYXMgY2hhbWFkYXMgdmlhIHVudHlwZWRGcm9tKCk6ICRjYWxsZWRfY291bnQiCmVjaG8gIlRhYmVsYXMgbm8gc2NoZW1hIGdlcmFkbyAodHlwZXMudHMpOiAkc2NoZW1hX2NvdW50IgplY2hvICIiCgppZiBbWyAiJGNhbGxlZF9jb3VudCIgLWVxIDAgXV07IHRoZW4KICBlY2hvICLinIUgTmVuaHVtYSBjaGFtYWRhIHVudHlwZWRGcm9tKCkgZW5jb250cmFkYSDigJQgZm9udGUgZXN0w6EgdG90YWxtZW50ZSB0aXBhZGEuIgogIGV4aXQgMApmaQoKIyAzKSBEaWZmOiB0YWJlbGFzIGVtIHVudHlwZWRGcm9tIHF1ZSBOw4NPIGV4aXN0ZW0gbm8gc2NoZW1hCmNvbW0gLTIzICIkdG1wX2NhbGxlZCIgIiR0bXBfc2NoZW1hIiA+ICIkdG1wX21pc3NpbmciCgppZiBbWyAhIC1zICIkdG1wX21pc3NpbmciIF1dOyB0aGVuCiAgZWNobyAi4pyFIFRvZGFzIGFzICRjYWxsZWRfY291bnQgdGFiZWxhcyBjaGFtYWRhcyB2aWEgdW50eXBlZEZyb20oKSBleGlzdGVtIgogIGVjaG8gIiAgIG5vIHNjaGVtYSBnZXJhZG8uIENvbnNpZGVyZSBtaWdyw6EtbGFzIHBhcmEgc3VwYWJhc2UuZnJvbSgpIHRpcGFkby4iCiAgZWNobyAiIgogIGVjaG8gIkNoYW1hZGFzIGRldGVjdGFkYXM6IgogIHNlZCAncy9eLyAgLSAvJyAiJHRtcF9jYWxsZWQiCiAgZXhpdCAwCmZpCgptaXNzaW5nX2NvdW50PSQod2MgLWwgPCAiJHRtcF9taXNzaW5nIiB8IHRyIC1kICcgJykKCmVjaG8gIjo6ZXJyb3I6OiRtaXNzaW5nX2NvdW50IHRhYmVsYShzKSBlbSB1bnR5cGVkRnJvbSgpIG7Do28gZXhpc3RlbSBubyBzY2hlbWEgZ2VyYWRvOiIKc2VkICdzL14vICAtIC8nICIkdG1wX21pc3NpbmciCmVjaG8gIiIKZWNobyAiUG9zc8OtdmVpcyBjYXVzYXM6IgplY2hvICIgIDEuIEEgdGFiZWxhIG7Do28gZXhpc3RlIG5vIGJhbmNvLiBDcmllIHVtYSBtaWdyYXRpb24gcXVlIGEgcmVzdGF1cmUiCmVjaG8gIiAgICAgKHZlciBQUiAjMzE1IC8gIzMxNyBjb21vIHJlZmVyw6puY2lhKS4iCmVjaG8gIiAgMi4gZGF0YWJhc2UudHlwZXMudHMgZXN0w6EgZGVzYXR1YWxpemFkby4gUm9kZToiCmVjaG8gIiAgICAgICBzdXBhYmFzZSBnZW4gdHlwZXMgdHlwZXNjcmlwdCAtLXByb2plY3QtaWQgPGlkPiBcXCIKZWNobyAiICAgICAgICAgPiBzcmMvaW50ZWdyYXRpb25zL3N1cGFiYXNlL3R5cGVzLnRzIgplY2hvICIiCmVjaG8gIkVzdGUgbGludCBleGlzdGUgcHJhIGV2aXRhciBhIHJlZ3Jlc3PDo28gZG8gY29sYXBzbyBkZSAyMDI2LTA1LTI0LCIKZWNobyAicXVhbmRvIHRhYmVsYXMgaW5leGlzdGVudGVzIG5vIGJhbmNvIHF1ZWJyYXZhbSBmZWF0dXJlcyBzaWxlbmNpb3NhbWVudGUuIgpleGl0IDEK \ No newline at end of file +#!/usr/bin/env bash +# Lint: cruza nomes de tabela chamados via untypedFrom("...") contra o +# schema gerado em src/integrations/supabase/types.ts. Falha se houver +# tabela em untypedFrom() que NÃO aparece no types.ts. +# +# Origem: o colapso de 2026-05-24 (PRs #315 e #317) foi causado por 14 +# tabelas chamadas via untypedFrom() que não existiam no banco. O front +# tem `catch { return []; }` em cada chamada, então features quebravam +# em silêncio. Este lint evita a regressão. +# +# Possíveis falhas: +# 1. A tabela não existe no banco → criar migration que a restaure. +# 2. database.types.ts está desatualizado → rodar `supabase gen types`. +# +# Uso local: ./scripts/lint-untyped-from.sh +# Uso CI: .github/workflows/lint-untyped-from.yml + +set -euo pipefail + +REPO_ROOT="${1:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}" +TYPES_FILE="$REPO_ROOT/src/integrations/supabase/types.ts" +SRC_DIR="$REPO_ROOT/src" +DEF_FILE="src/lib/supabase-untyped.ts" + +if [[ ! -f "$TYPES_FILE" ]]; then + echo "::error::types.ts não encontrado em $TYPES_FILE" + echo "Rode 'supabase gen types typescript --project-id > $TYPES_FILE' antes." + exit 2 +fi + +if [[ ! -d "$SRC_DIR" ]]; then + echo "::error::diretório src/ não encontrado em $SRC_DIR" + exit 2 +fi + +tmp_called=$(mktemp) +tmp_schema=$(mktemp) +tmp_missing=$(mktemp) +trap 'rm -f "$tmp_called" "$tmp_schema" "$tmp_missing"' EXIT + +# 1) Tabelas chamadas via untypedFrom("...") ou untypedFrom('...') em src/ +# (exclui a própria definição em supabase-untyped.ts) +grep -rhE "untypedFrom[^(]*\(['\"]([a-z_][a-z0-9_]*)['\"]" "$SRC_DIR" \ + --include='*.ts' --include='*.tsx' --exclude='supabase-untyped.ts' 2>/dev/null \ + | sed -E "s/.*untypedFrom[^(]*\(['\"]([a-z_][a-z0-9_]+)['\"].*/\1/" \ + | sort -u > "$tmp_called" || true + +# 2) Nomes de tabela no types.ts gerado. +# Estrutura: dentro de `Tables: {`, cada chave é uma tabela com 6 +# espaços de indentação seguida de `: {`. +grep -E '^ [a-z_][a-z0-9_]+: \{$' "$TYPES_FILE" \ + | sed -E 's/^ ([a-z_][a-z0-9_]+):.*/\1/' \ + | sort -u > "$tmp_schema" + +called_count=$(wc -l < "$tmp_called" | tr -d ' ') +schema_count=$(wc -l < "$tmp_schema" | tr -d ' ') + +echo "=== lint-untyped-from ===" +echo "Tabelas chamadas via untypedFrom(): $called_count" +echo "Tabelas no schema gerado (types.ts): $schema_count" +echo "" + +if [[ "$called_count" -eq 0 ]]; then + echo "✅ Nenhuma chamada untypedFrom() encontrada — fonte está totalmente tipada." + exit 0 +fi + +# 3) Diff: tabelas em untypedFrom que NÃO existem no schema +comm -23 "$tmp_called" "$tmp_schema" > "$tmp_missing" + +if [[ ! -s "$tmp_missing" ]]; then + echo "✅ Todas as $called_count tabelas chamadas via untypedFrom() existem" + echo " no schema gerado. Considere migrá-las para supabase.from() tipado." + echo "" + echo "Chamadas detectadas:" + sed 's/^/ - /' "$tmp_called" + exit 0 +fi + +missing_count=$(wc -l < "$tmp_missing" | tr -d ' ') + +echo "::error::$missing_count tabela(s) em untypedFrom() não existem no schema gerado:" +sed 's/^/ - /' "$tmp_missing" +echo "" +echo "Possíveis causas:" +echo " 1. A tabela não existe no banco. Crie uma migration que a restaure" +echo " (ver PR #315 / #317 como referência)." +echo " 2. database.types.ts está desatualizado. Rode:" +echo " supabase gen types typescript --project-id \\" +echo " > src/integrations/supabase/types.ts" +echo "" +echo "Este lint existe pra evitar a regressão do colapso de 2026-05-24," +echo "quando tabelas inexistentes no banco quebravam features silenciosamente." +exit 1 diff --git a/src/hooks/useKillSwitchBanner.ts b/src/hooks/useKillSwitchBanner.ts index cdd69247e..0c79a9755 100644 --- a/src/hooks/useKillSwitchBanner.ts +++ b/src/hooks/useKillSwitchBanner.ts @@ -8,7 +8,10 @@ * if (banner) return ; */ import { useEffect, useState } from 'react'; -import { getKillSwitchState, KillSwitchActiveError } from '@/lib/external-db/kill-switch-client'; +import { + getKillSwitchState, + type KillSwitchActiveError, +} from '@/lib/external-db/kill-switch-client'; const SWITCH_NAME = 'edge_external_db_bridge'; const POLL_INTERVAL_MS = 120_000; // 2min — não-crítico, polling leve diff --git a/src/integrations/supabase/types.ts b/src/integrations/supabase/types.ts index d4d8dbfd3..73c449b26 100644 --- a/src/integrations/supabase/types.ts +++ b/src/integrations/supabase/types.ts @@ -10,10 +10,166 @@ export type Database = { // Allows to automatically instantiate createClient with right options // instead of createClient(URL, KEY) __InternalSupabase: { - PostgrestVersion: "14.5" + PostgrestVersion: "14.1" } public: { Tables: { + _asia_api_staging: { + Row: { + altura: number | null + categorias: Json | null + comprimento: number | null + created_at: string | null + galeria: Json | null + largura: number | null + nome: string | null + origem_faturamento: string | null + peso: number | null + promocao: number | null + propriedades: Json | null + raw_json: Json + referencia: string + tags: Json | null + total_variacoes: number | null + video: string | null + } + Insert: { + altura?: number | null + categorias?: Json | null + comprimento?: number | null + created_at?: string | null + galeria?: Json | null + largura?: number | null + nome?: string | null + origem_faturamento?: string | null + peso?: number | null + promocao?: number | null + propriedades?: Json | null + raw_json: Json + referencia: string + tags?: Json | null + total_variacoes?: number | null + video?: string | null + } + Update: { + altura?: number | null + categorias?: Json | null + comprimento?: number | null + created_at?: string | null + galeria?: Json | null + largura?: number | null + nome?: string | null + origem_faturamento?: string | null + peso?: number | null + promocao?: number | null + propriedades?: Json | null + raw_json?: Json + referencia?: string + tags?: Json | null + total_variacoes?: number | null + video?: string | null + } + Relationships: [] + } + _unif_pending_log: { + Row: { + acao: string + contexto: Json | null + decisao_em: string + id: number + observacao: string | null + prioridade: string + revisar_em: string | null + status: string + ticket: string + } + Insert: { + acao: string + contexto?: Json | null + decisao_em?: string + id?: number + observacao?: string | null + prioridade: string + revisar_em?: string | null + status: string + ticket: string + } + Update: { + acao?: string + contexto?: Json | null + decisao_em?: string + id?: number + observacao?: string | null + prioridade?: string + revisar_em?: string | null + status?: string + ticket?: string + } + Relationships: [] + } + _unif_settings_arquivo: { + Row: { + arquivado_em: string | null + description: string | null + id: number + motivo: string | null + setting_key: string + setting_value: Json + } + Insert: { + arquivado_em?: string | null + description?: string | null + id?: number + motivo?: string | null + setting_key: string + setting_value: Json + } + Update: { + arquivado_em?: string | null + description?: string | null + id?: number + motivo?: string | null + setting_key?: string + setting_value?: Json + } + Relationships: [] + } + access_blocked_log: { + Row: { + block_reason: string + city: string | null + country: string | null + created_at: string + email: string | null + id: string + ip_address: string + state: string | null + user_agent: string | null + } + Insert: { + block_reason: string + city?: string | null + country?: string | null + created_at?: string + email?: string | null + id?: string + ip_address: string + state?: string | null + user_agent?: string | null + } + Update: { + block_reason?: string + city?: string | null + country?: string | null + created_at?: string + email?: string | null + id?: string + ip_address?: string + state?: string | null + user_agent?: string | null + } + Relationships: [] + } access_security_settings: { Row: { block_unknown_locations: boolean | null @@ -107,473 +263,661 @@ export type Database = { } Relationships: [] } - admin_audit_log_y2025m12: { - Row: { - action: string - created_at: string - details: Json | null - duration_ms: number | null - finished_at: string | null - id: string - ip_address: string | null - payload_summary: Json | null - request_id: string | null - resource_id: string | null - resource_type: string - source: string | null - started_at: string | null - status: string | null - user_agent: string | null - user_id: string - } - Insert: { - action: string - created_at?: string - details?: Json | null - duration_ms?: number | null - finished_at?: string | null - id?: string - ip_address?: string | null - payload_summary?: Json | null - request_id?: string | null - resource_id?: string | null - resource_type: string - source?: string | null - started_at?: string | null - status?: string | null - user_agent?: string | null - user_id: string - } - Update: { - action?: string - created_at?: string - details?: Json | null - duration_ms?: number | null - finished_at?: string | null - id?: string - ip_address?: string | null - payload_summary?: Json | null - request_id?: string | null - resource_id?: string | null - resource_type?: string - source?: string | null - started_at?: string | null - status?: string | null - user_agent?: string | null - user_id?: string - } - Relationships: [] - } - admin_audit_log_y2026m01: { + admin_settings: { Row: { - action: string created_at: string - details: Json | null - duration_ms: number | null - finished_at: string | null id: string - ip_address: string | null - payload_summary: Json | null - request_id: string | null - resource_id: string | null - resource_type: string - source: string | null - started_at: string | null - status: string | null - user_agent: string | null - user_id: string + key: string + updated_at: string + updated_by: string | null + value: Json } Insert: { - action: string created_at?: string - details?: Json | null - duration_ms?: number | null - finished_at?: string | null id?: string - ip_address?: string | null - payload_summary?: Json | null - request_id?: string | null - resource_id?: string | null - resource_type: string - source?: string | null - started_at?: string | null - status?: string | null - user_agent?: string | null - user_id: string + key: string + updated_at?: string + updated_by?: string | null + value?: Json } Update: { - action?: string created_at?: string - details?: Json | null - duration_ms?: number | null - finished_at?: string | null id?: string - ip_address?: string | null - payload_summary?: Json | null - request_id?: string | null - resource_id?: string | null - resource_type?: string - source?: string | null - started_at?: string | null - status?: string | null - user_agent?: string | null - user_id?: string + key?: string + updated_at?: string + updated_by?: string | null + value?: Json } Relationships: [] } - admin_audit_log_y2026m02: { + ai_description_queue: { Row: { - action: string - created_at: string - details: Json | null - duration_ms: number | null - finished_at: string | null + ai_model: string | null + attempts: number + completed_at: string | null + error_message: string | null id: string - ip_address: string | null - payload_summary: Json | null - request_id: string | null - resource_id: string | null - resource_type: string - source: string | null + max_attempts: number + organization_id: string | null + priority: number + product_id: string + queued_at: string started_at: string | null - status: string | null - user_agent: string | null - user_id: string + status: string } Insert: { - action: string - created_at?: string - details?: Json | null - duration_ms?: number | null - finished_at?: string | null + ai_model?: string | null + attempts?: number + completed_at?: string | null + error_message?: string | null id?: string - ip_address?: string | null - payload_summary?: Json | null - request_id?: string | null - resource_id?: string | null - resource_type: string - source?: string | null + max_attempts?: number + organization_id?: string | null + priority?: number + product_id: string + queued_at?: string started_at?: string | null - status?: string | null - user_agent?: string | null - user_id: string + status?: string } Update: { - action?: string - created_at?: string - details?: Json | null - duration_ms?: number | null - finished_at?: string | null + ai_model?: string | null + attempts?: number + completed_at?: string | null + error_message?: string | null id?: string - ip_address?: string | null - payload_summary?: Json | null - request_id?: string | null - resource_id?: string | null - resource_type?: string - source?: string | null + max_attempts?: number + organization_id?: string | null + priority?: number + product_id?: string + queued_at?: string started_at?: string | null - status?: string | null - user_agent?: string | null - user_id?: string + status?: string } - Relationships: [] - } - admin_audit_log_y2026m03: { - Row: { - action: string - created_at: string - details: Json | null - duration_ms: number | null - finished_at: string | null - id: string - ip_address: string | null - payload_summary: Json | null - request_id: string | null - resource_id: string | null - resource_type: string - source: string | null - started_at: string | null - status: string | null - user_agent: string | null - user_id: string + Relationships: [ + { + foreignKeyName: "ai_description_queue_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "ai_description_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: true + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + ai_function_routing: { + Row: { + created_at: string + fallback_model_ids: string[] + function_name: string + id: string + is_active: boolean + notes: string | null + primary_model_id: string + request_overrides: Json + required_capabilities: Json + updated_at: string + updated_by: string | null } Insert: { - action: string created_at?: string - details?: Json | null - duration_ms?: number | null - finished_at?: string | null + fallback_model_ids?: string[] + function_name: string id?: string - ip_address?: string | null - payload_summary?: Json | null - request_id?: string | null - resource_id?: string | null - resource_type: string - source?: string | null - started_at?: string | null - status?: string | null - user_agent?: string | null - user_id: string + is_active?: boolean + notes?: string | null + primary_model_id: string + request_overrides?: Json + required_capabilities?: Json + updated_at?: string + updated_by?: string | null } Update: { - action?: string created_at?: string - details?: Json | null - duration_ms?: number | null - finished_at?: string | null + fallback_model_ids?: string[] + function_name?: string id?: string - ip_address?: string | null - payload_summary?: Json | null - request_id?: string | null - resource_id?: string | null - resource_type?: string - source?: string | null - started_at?: string | null - status?: string | null - user_agent?: string | null - user_id?: string + is_active?: boolean + notes?: string | null + primary_model_id?: string + request_overrides?: Json + required_capabilities?: Json + updated_at?: string + updated_by?: string | null } - Relationships: [] + Relationships: [ + { + foreignKeyName: "ai_function_routing_primary_model_id_fkey" + columns: ["primary_model_id"] + isOneToOne: false + referencedRelation: "ai_models" + referencedColumns: ["id"] + }, + { + foreignKeyName: "ai_function_routing_primary_model_id_fkey" + columns: ["primary_model_id"] + isOneToOne: false + referencedRelation: "v_ai_function_routing_effective" + referencedColumns: ["primary_model_id"] + }, + ] } - admin_audit_log_y2026m04: { + ai_insights_cache: { Row: { - action: string + cache_key: string created_at: string - details: Json | null duration_ms: number | null - finished_at: string | null + expires_at: string + function_name: string id: string - ip_address: string | null - payload_summary: Json | null - request_id: string | null - resource_id: string | null - resource_type: string - source: string | null - started_at: string | null - status: string | null - user_agent: string | null + model: string | null + payload: Json + tokens_input: number | null + tokens_output: number | null user_id: string } Insert: { - action: string + cache_key: string created_at?: string - details?: Json | null duration_ms?: number | null - finished_at?: string | null + expires_at?: string + function_name: string id?: string - ip_address?: string | null - payload_summary?: Json | null - request_id?: string | null - resource_id?: string | null - resource_type: string - source?: string | null - started_at?: string | null - status?: string | null - user_agent?: string | null + model?: string | null + payload: Json + tokens_input?: number | null + tokens_output?: number | null user_id: string } Update: { - action?: string + cache_key?: string created_at?: string - details?: Json | null duration_ms?: number | null - finished_at?: string | null + expires_at?: string + function_name?: string id?: string - ip_address?: string | null - payload_summary?: Json | null - request_id?: string | null - resource_id?: string | null - resource_type?: string - source?: string | null - started_at?: string | null - status?: string | null - user_agent?: string | null + model?: string | null + payload?: Json + tokens_input?: number | null + tokens_output?: number | null user_id?: string } Relationships: [] } - admin_audit_log_y2026m05: { + ai_models: { Row: { - action: string + capabilities: Json + cost_input_per_1m: number + cost_output_per_1m: number + cost_per_image: number created_at: string - details: Json | null - duration_ms: number | null - finished_at: string | null + display_name: string id: string - ip_address: string | null - payload_summary: Json | null - request_id: string | null - resource_id: string | null - resource_type: string - source: string | null - started_at: string | null - status: string | null - user_agent: string | null - user_id: string + is_active: boolean + max_input_tokens: number | null + max_output_tokens: number | null + metadata: Json + model_id: string + provider_id: string + updated_at: string } Insert: { - action: string + capabilities?: Json + cost_input_per_1m?: number + cost_output_per_1m?: number + cost_per_image?: number created_at?: string - details?: Json | null - duration_ms?: number | null - finished_at?: string | null + display_name: string id?: string - ip_address?: string | null - payload_summary?: Json | null - request_id?: string | null - resource_id?: string | null - resource_type: string - source?: string | null - started_at?: string | null - status?: string | null - user_agent?: string | null - user_id: string + is_active?: boolean + max_input_tokens?: number | null + max_output_tokens?: number | null + metadata?: Json + model_id: string + provider_id: string + updated_at?: string } Update: { - action?: string + capabilities?: Json + cost_input_per_1m?: number + cost_output_per_1m?: number + cost_per_image?: number created_at?: string - details?: Json | null - duration_ms?: number | null - finished_at?: string | null + display_name?: string id?: string - ip_address?: string | null - payload_summary?: Json | null - request_id?: string | null - resource_id?: string | null - resource_type?: string - source?: string | null - started_at?: string | null - status?: string | null - user_agent?: string | null - user_id?: string + is_active?: boolean + max_input_tokens?: number | null + max_output_tokens?: number | null + metadata?: Json + model_id?: string + provider_id?: string + updated_at?: string } - Relationships: [] + Relationships: [ + { + foreignKeyName: "ai_models_provider_id_fkey" + columns: ["provider_id"] + isOneToOne: false + referencedRelation: "ai_providers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "ai_models_provider_id_fkey" + columns: ["provider_id"] + isOneToOne: false + referencedRelation: "v_ai_function_routing_effective" + referencedColumns: ["primary_provider_id"] + }, + ] } - admin_audit_log_y2026m06: { + ai_provider_quotas: { Row: { - action: string + alert_threshold_pct: number created_at: string - details: Json | null - duration_ms: number | null - finished_at: string | null + current_period_start: string + current_period_usage_tokens: number + current_period_usage_usd: number + hard_stop: boolean id: string - ip_address: string | null - payload_summary: Json | null - request_id: string | null - resource_id: string | null - resource_type: string - source: string | null - started_at: string | null - status: string | null - user_agent: string | null - user_id: string + is_active: boolean + monthly_limit_tokens: number | null + monthly_limit_usd: number | null + notes: string | null + provider_id: string + updated_at: string } Insert: { - action: string + alert_threshold_pct?: number created_at?: string - details?: Json | null - duration_ms?: number | null - finished_at?: string | null + current_period_start?: string + current_period_usage_tokens?: number + current_period_usage_usd?: number + hard_stop?: boolean id?: string - ip_address?: string | null - payload_summary?: Json | null - request_id?: string | null - resource_id?: string | null - resource_type: string - source?: string | null - started_at?: string | null - status?: string | null - user_agent?: string | null - user_id: string + is_active?: boolean + monthly_limit_tokens?: number | null + monthly_limit_usd?: number | null + notes?: string | null + provider_id: string + updated_at?: string } Update: { - action?: string + alert_threshold_pct?: number created_at?: string - details?: Json | null - duration_ms?: number | null - finished_at?: string | null + current_period_start?: string + current_period_usage_tokens?: number + current_period_usage_usd?: number + hard_stop?: boolean id?: string - ip_address?: string | null - payload_summary?: Json | null - request_id?: string | null - resource_id?: string | null - resource_type?: string - source?: string | null - started_at?: string | null - status?: string | null - user_agent?: string | null - user_id?: string + is_active?: boolean + monthly_limit_tokens?: number | null + monthly_limit_usd?: number | null + notes?: string | null + provider_id?: string + updated_at?: string } - Relationships: [] + Relationships: [ + { + foreignKeyName: "ai_provider_quotas_provider_id_fkey" + columns: ["provider_id"] + isOneToOne: false + referencedRelation: "ai_providers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "ai_provider_quotas_provider_id_fkey" + columns: ["provider_id"] + isOneToOne: false + referencedRelation: "v_ai_function_routing_effective" + referencedColumns: ["primary_provider_id"] + }, + ] } - admin_settings: { + ai_providers: { Row: { + api_base_url: string + api_format: string + auth_format: string + auth_header: string created_at: string + created_by: string | null + display_name: string id: string - key: string + is_active: boolean + last_latency_ms: number | null + last_test_at: string | null + last_test_message: string | null + last_test_ok: boolean | null + max_retries: number + metadata: Json + priority: number + secret_name: string + slug: string + timeout_ms: number updated_at: string updated_by: string | null - value: Json } Insert: { + api_base_url: string + api_format: string + auth_format?: string + auth_header?: string created_at?: string + created_by?: string | null + display_name: string id?: string - key: string + is_active?: boolean + last_latency_ms?: number | null + last_test_at?: string | null + last_test_message?: string | null + last_test_ok?: boolean | null + max_retries?: number + metadata?: Json + priority?: number + secret_name: string + slug: string + timeout_ms?: number updated_at?: string updated_by?: string | null - value?: Json } Update: { + api_base_url?: string + api_format?: string + auth_format?: string + auth_header?: string created_at?: string + created_by?: string | null + display_name?: string id?: string - key?: string + is_active?: boolean + last_latency_ms?: number | null + last_test_at?: string | null + last_test_message?: string | null + last_test_ok?: boolean | null + max_retries?: number + metadata?: Json + priority?: number + secret_name?: string + slug?: string + timeout_ms?: number updated_at?: string updated_by?: string | null - value?: Json } Relationships: [] } - ai_insights_cache: { + ai_routing_decisions: { Row: { - cache_key: string + attempted_models: string[] + attempted_outcomes: Json + attempted_providers: string[] created_at: string - duration_ms: number | null - expires_at: string + final_model_id: string | null + final_provider_id: string | null function_name: string id: string - model: string | null - payload: Json - tokens_input: number | null - tokens_output: number | null - user_id: string + outcome: string + request_id: string | null + total_attempts: number + total_duration_ms: number + usage_log_id: string | null + user_id: string | null } Insert: { - cache_key: string + attempted_models: string[] + attempted_outcomes?: Json + attempted_providers: string[] created_at?: string - duration_ms?: number | null - expires_at?: string + final_model_id?: string | null + final_provider_id?: string | null function_name: string id?: string - model?: string | null - payload: Json - tokens_input?: number | null - tokens_output?: number | null - user_id: string + outcome: string + request_id?: string | null + total_attempts: number + total_duration_ms: number + usage_log_id?: string | null + user_id?: string | null } Update: { - cache_key?: string + attempted_models?: string[] + attempted_outcomes?: Json + attempted_providers?: string[] created_at?: string - duration_ms?: number | null - expires_at?: string + final_model_id?: string | null + final_provider_id?: string | null function_name?: string id?: string - model?: string | null - payload?: Json - tokens_input?: number | null - tokens_output?: number | null - user_id?: string + outcome?: string + request_id?: string | null + total_attempts?: number + total_duration_ms?: number + usage_log_id?: string | null + user_id?: string | null } - Relationships: [] + Relationships: [ + { + foreignKeyName: "ai_routing_decisions_final_model_id_fkey" + columns: ["final_model_id"] + isOneToOne: false + referencedRelation: "ai_models" + referencedColumns: ["id"] + }, + { + foreignKeyName: "ai_routing_decisions_final_model_id_fkey" + columns: ["final_model_id"] + isOneToOne: false + referencedRelation: "v_ai_function_routing_effective" + referencedColumns: ["primary_model_id"] + }, + { + foreignKeyName: "ai_routing_decisions_final_provider_id_fkey" + columns: ["final_provider_id"] + isOneToOne: false + referencedRelation: "ai_providers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "ai_routing_decisions_final_provider_id_fkey" + columns: ["final_provider_id"] + isOneToOne: false + referencedRelation: "v_ai_function_routing_effective" + referencedColumns: ["primary_provider_id"] + }, + ] } ai_usage_events: { Row: { @@ -607,46 +951,46 @@ export type Database = { created_at: string duration_ms: number | null error_message: string | null - estimated_cost_usd: number | null + estimated_cost_usd: number function_name: string id: string - input_tokens: number | null - metadata: Json | null + input_tokens: number + metadata: Json model: string | null - output_tokens: number | null + output_tokens: number status: string total_tokens: number | null - user_id: string + user_id: string | null } Insert: { created_at?: string duration_ms?: number | null error_message?: string | null - estimated_cost_usd?: number | null + estimated_cost_usd?: number function_name: string id?: string - input_tokens?: number | null - metadata?: Json | null + input_tokens?: number + metadata?: Json model?: string | null - output_tokens?: number | null + output_tokens?: number status?: string total_tokens?: number | null - user_id: string + user_id?: string | null } Update: { created_at?: string duration_ms?: number | null error_message?: string | null - estimated_cost_usd?: number | null + estimated_cost_usd?: number function_name?: string id?: string - input_tokens?: number | null - metadata?: Json | null + input_tokens?: number + metadata?: Json model?: string | null - output_tokens?: number | null + output_tokens?: number status?: string total_tokens?: number | null - user_id?: string + user_id?: string | null } Relationships: [] } @@ -677,6 +1021,72 @@ export type Database = { } Relationships: [] } + analytics_events: { + Row: { + created_at: string | null + event_name: string + event_type: string + id: string + ip_address: unknown + properties: Json | null + session_id: string | null + user_agent: string | null + user_id: string | null + } + Insert: { + created_at?: string | null + event_name: string + event_type: string + id?: string + ip_address?: unknown + properties?: Json | null + session_id?: string | null + user_agent?: string | null + user_id?: string | null + } + Update: { + created_at?: string | null + event_name?: string + event_type?: string + id?: string + ip_address?: unknown + properties?: Json | null + session_id?: string | null + user_agent?: string | null + user_id?: string | null + } + Relationships: [] + } + api_usage: { + Row: { + cost_usd: number | null + credits_limit: number | null + credits_used: number | null + id: string + period_month: string + provider: string + updated_at: string | null + } + Insert: { + cost_usd?: number | null + credits_limit?: number | null + credits_used?: number | null + id?: string + period_month: string + provider: string + updated_at?: string | null + } + Update: { + cost_usd?: number | null + credits_limit?: number | null + credits_used?: number | null + id?: string + period_month?: string + provider?: string + updated_at?: string | null + } + Relationships: [] + } app_vitals: { Row: { created_at: string @@ -761,6049 +1171,31080 @@ export type Database = { } Relationships: [] } - audit_logs: { + attribute_definitions: { Row: { created_at: string | null - endpoint: string - event_type: string + data_type: string | null + default_value: string | null + description: string | null + display_name: string + display_order: number | null + group_id: string | null id: string - identifier: string - metadata: Json | null + is_active: boolean | null + is_comparable: boolean | null + is_filterable: boolean | null + is_required: boolean | null + is_searchable: boolean | null + is_visible: boolean | null + name: string + organization_id: string + possible_values: Json | null + slug: string + unit: string | null + updated_at: string | null + validation_rules: Json | null } Insert: { created_at?: string | null - endpoint: string - event_type: string + data_type?: string | null + default_value?: string | null + description?: string | null + display_name: string + display_order?: number | null + group_id?: string | null id?: string - identifier: string - metadata?: Json | null + is_active?: boolean | null + is_comparable?: boolean | null + is_filterable?: boolean | null + is_required?: boolean | null + is_searchable?: boolean | null + is_visible?: boolean | null + name: string + organization_id: string + possible_values?: Json | null + slug: string + unit?: string | null + updated_at?: string | null + validation_rules?: Json | null } Update: { created_at?: string | null - endpoint?: string - event_type?: string + data_type?: string | null + default_value?: string | null + description?: string | null + display_name?: string + display_order?: number | null + group_id?: string | null id?: string - identifier?: string - metadata?: Json | null + is_active?: boolean | null + is_comparable?: boolean | null + is_filterable?: boolean | null + is_required?: boolean | null + is_searchable?: boolean | null + is_visible?: boolean | null + name?: string + organization_id?: string + possible_values?: Json | null + slug?: string + unit?: string | null + updated_at?: string | null + validation_rules?: Json | null } - Relationships: [] + Relationships: [ + { + foreignKeyName: "attribute_definitions_group_id_fkey" + columns: ["group_id"] + isOneToOne: false + referencedRelation: "attribute_groups" + referencedColumns: ["id"] + }, + { + foreignKeyName: "attribute_definitions_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + ] } - auth_login_attempts: { + attribute_equivalences: { Row: { - created_at: string - email: string - failure_reason: string | null + confidence_score: number | null + created_at: string | null id: string - ip_address: string | null - success: boolean - user_agent: string | null + is_active: boolean | null + match_quality: string | null + notes: string | null + organization_id: string + promo_attribute_id: string + source: string | null + supplier_attribute_id: string + updated_at: string | null + value_transformation: Json | null + verified: boolean | null + verified_at: string | null + verified_by: string | null } Insert: { - created_at?: string - email: string - failure_reason?: string | null + confidence_score?: number | null + created_at?: string | null id?: string - ip_address?: string | null - success?: boolean - user_agent?: string | null + is_active?: boolean | null + match_quality?: string | null + notes?: string | null + organization_id: string + promo_attribute_id: string + source?: string | null + supplier_attribute_id: string + updated_at?: string | null + value_transformation?: Json | null + verified?: boolean | null + verified_at?: string | null + verified_by?: string | null } Update: { - created_at?: string - email?: string - failure_reason?: string | null + confidence_score?: number | null + created_at?: string | null id?: string - ip_address?: string | null - success?: boolean - user_agent?: string | null + is_active?: boolean | null + match_quality?: string | null + notes?: string | null + organization_id?: string + promo_attribute_id?: string + source?: string | null + supplier_attribute_id?: string + updated_at?: string | null + value_transformation?: Json | null + verified?: boolean | null + verified_at?: string | null + verified_by?: string | null } - Relationships: [] + Relationships: [ + { + foreignKeyName: "attribute_equivalences_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "attribute_equivalences_promo_attribute_id_fkey" + columns: ["promo_attribute_id"] + isOneToOne: false + referencedRelation: "attribute_definitions" + referencedColumns: ["id"] + }, + { + foreignKeyName: "attribute_equivalences_supplier_attribute_id_fkey" + columns: ["supplier_attribute_id"] + isOneToOne: false + referencedRelation: "supplier_attribute_definitions" + referencedColumns: ["id"] + }, + { + foreignKeyName: "attribute_equivalences_verified_by_fkey" + columns: ["verified_by"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + }, + ] } - bot_detection_log: { + attribute_groups: { Row: { - blocked: boolean - created_at: string - detection_reason: string - endpoint: string + created_at: string | null + description: string | null + display_order: number | null + icon: string | null id: string - ip_address: string - metadata: Json | null - request_count: number | null + is_active: boolean | null + name: string + organization_id: string + slug: string + updated_at: string | null + } + Insert: { + created_at?: string | null + description?: string | null + display_order?: number | null + icon?: string | null + id?: string + is_active?: boolean | null + name: string + organization_id: string + slug: string + updated_at?: string | null + } + Update: { + created_at?: string | null + description?: string | null + display_order?: number | null + icon?: string | null + id?: string + is_active?: boolean | null + name?: string + organization_id?: string + slug?: string + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "attribute_groups_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + ] + } + audit_log: { + Row: { + action: string + created_at: string | null + entity_id: string | null + entity_type: string + id: string + ip_address: unknown + new_values: Json | null + old_values: Json | null user_agent: string | null + user_id: string | null } Insert: { - blocked?: boolean - created_at?: string - detection_reason: string - endpoint: string + action: string + created_at?: string | null + entity_id?: string | null + entity_type: string id?: string - ip_address: string - metadata?: Json | null - request_count?: number | null + ip_address?: unknown + new_values?: Json | null + old_values?: Json | null user_agent?: string | null + user_id?: string | null } Update: { - blocked?: boolean - created_at?: string - detection_reason?: string - endpoint?: string + action?: string + created_at?: string | null + entity_id?: string | null + entity_type?: string id?: string - ip_address?: string - metadata?: Json | null - request_count?: number | null + ip_address?: unknown + new_values?: Json | null + old_values?: Json | null user_agent?: string | null + user_id?: string | null } Relationships: [] } - cart_templates: { + audit_log_gravacao: { Row: { - created_at: string - description: string | null - id: string - items: Json - name: string - updated_at: string - user_id: string + campos_alterados: Json | null + codigo_tabela: string | null + id: number + operacao: string + registro_id: string + tabela_origem: string + ts: string | null + usuario: string | null + valor_antes: Json | null + valor_depois: Json | null } Insert: { - created_at?: string - description?: string | null - id?: string - items?: Json - name: string - updated_at?: string - user_id: string + campos_alterados?: Json | null + codigo_tabela?: string | null + id?: number + operacao: string + registro_id: string + tabela_origem: string + ts?: string | null + usuario?: string | null + valor_antes?: Json | null + valor_depois?: Json | null } Update: { - created_at?: string - description?: string | null - id?: string - items?: Json - name?: string - updated_at?: string - user_id?: string + campos_alterados?: Json | null + codigo_tabela?: string | null + id?: number + operacao?: string + registro_id?: string + tabela_origem?: string + ts?: string | null + usuario?: string | null + valor_antes?: Json | null + valor_depois?: Json | null } Relationships: [] } - category_icons: { + audit_logs: { Row: { - category_name: string - created_at: string - description: string | null - icon: string + created_at: string | null + endpoint: string + event_type: string id: string - is_active: boolean - updated_at: string + identifier: string + metadata: Json | null } Insert: { - category_name: string - created_at?: string - description?: string | null - icon: string + created_at?: string | null + endpoint: string + event_type: string id?: string - is_active?: boolean - updated_at?: string + identifier: string + metadata?: Json | null } Update: { - category_name?: string - created_at?: string - description?: string | null - icon?: string + created_at?: string | null + endpoint?: string + event_type?: string id?: string - is_active?: boolean - updated_at?: string + identifier?: string + metadata?: Json | null } Relationships: [] } - collection_item_reactions: { + auth_login_attempts: { Row: { - anon_id: string - collection_id: string created_at: string - emoji: string + email: string + failure_reason: string | null id: string - ip_hash: string | null - item_id: string + ip_address: string | null + success: boolean user_agent: string | null } Insert: { - anon_id: string - collection_id: string created_at?: string - emoji: string + email: string + failure_reason?: string | null id?: string - ip_hash?: string | null - item_id: string + ip_address?: string | null + success?: boolean user_agent?: string | null } Update: { - anon_id?: string - collection_id?: string created_at?: string - emoji?: string + email?: string + failure_reason?: string | null id?: string - ip_hash?: string | null - item_id?: string + ip_address?: string | null + success?: boolean user_agent?: string | null } Relationships: [] } - collection_items: { + auto_tag_rules: { Row: { - added_at: string - collection_id: string - color_hex: string | null - color_name: string | null - created_at: string + condition_field: string | null + condition_operator: string | null + condition_value: string | null + condition_value_max: string | null + created_at: string | null + id: string + is_active: boolean | null + organization_id: string + priority: number | null + rule_name: string + rule_type: string + tag_slug: string + updated_at: string | null + } + Insert: { + condition_field?: string | null + condition_operator?: string | null + condition_value?: string | null + condition_value_max?: string | null + created_at?: string | null + id?: string + is_active?: boolean | null + organization_id?: string + priority?: number | null + rule_name: string + rule_type: string + tag_slug: string + updated_at?: string | null + } + Update: { + condition_field?: string | null + condition_operator?: string | null + condition_value?: string | null + condition_value_max?: string | null + created_at?: string | null + id?: string + is_active?: boolean | null + organization_id?: string + priority?: number | null + rule_name?: string + rule_type?: string + tag_slug?: string + updated_at?: string | null + } + Relationships: [] + } + b2b_collection_products: { + Row: { + added_at: string | null + b2b_collection_id: string + display_order: number | null id: string - notes: string | null - price_at_save: number | null product_id: string - sort_order: number | null - thumbnail_url: string | null } Insert: { - added_at?: string - collection_id: string - color_hex?: string | null - color_name?: string | null - created_at?: string + added_at?: string | null + b2b_collection_id: string + display_order?: number | null id?: string - notes?: string | null - price_at_save?: number | null product_id: string - sort_order?: number | null - thumbnail_url?: string | null } Update: { - added_at?: string - collection_id?: string - color_hex?: string | null - color_name?: string | null - created_at?: string + added_at?: string | null + b2b_collection_id?: string + display_order?: number | null id?: string - notes?: string | null - price_at_save?: number | null product_id?: string - sort_order?: number | null - thumbnail_url?: string | null } Relationships: [ { - foreignKeyName: "collection_items_collection_id_fkey" - columns: ["collection_id"] + foreignKeyName: "b2b_collection_products_b2b_collection_id_fkey" + columns: ["b2b_collection_id"] isOneToOne: false - referencedRelation: "collections" + referencedRelation: "b2b_collections" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" referencedColumns: ["id"] }, ] } - collection_items_trash: { + b2b_collections: { Row: { - collection_id: string - color_hex: string | null - color_name: string | null - deleted_at: string - expires_at: string + created_at: string | null + created_by: string | null + description: string | null + display_order: number | null id: string - notes: string | null - original_id: string - price_at_save: number | null - product_id: string - sort_order: number | null - thumbnail_url: string | null - user_id: string + image_url: string | null + is_featured: boolean | null + is_public: boolean | null + name: string + organization_id: string | null + slug: string + updated_at: string | null } Insert: { - collection_id: string - color_hex?: string | null - color_name?: string | null - deleted_at?: string - expires_at?: string + created_at?: string | null + created_by?: string | null + description?: string | null + display_order?: number | null id?: string - notes?: string | null - original_id: string - price_at_save?: number | null - product_id: string - sort_order?: number | null - thumbnail_url?: string | null - user_id: string + image_url?: string | null + is_featured?: boolean | null + is_public?: boolean | null + name: string + organization_id?: string | null + slug: string + updated_at?: string | null } Update: { - collection_id?: string - color_hex?: string | null - color_name?: string | null - deleted_at?: string - expires_at?: string + created_at?: string | null + created_by?: string | null + description?: string | null + display_order?: number | null id?: string - notes?: string | null - original_id?: string - price_at_save?: number | null - product_id?: string - sort_order?: number | null - thumbnail_url?: string | null - user_id?: string + image_url?: string | null + is_featured?: boolean | null + is_public?: boolean | null + name?: string + organization_id?: string | null + slug?: string + updated_at?: string | null } - Relationships: [] + Relationships: [ + { + foreignKeyName: "collections_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + ] } - collections: { + bitrix_clients: { Row: { - client_id: string | null - client_name: string | null created_at: string - description: string | null - icon: string | null - icon_color: string | null id: string - is_deleted: boolean - is_featured: boolean - is_public: boolean name: string - share_expires_at: string | null - share_token: string | null + ramo: string | null updated_at: string - user_id: string } Insert: { - client_id?: string | null - client_name?: string | null created_at?: string - description?: string | null - icon?: string | null - icon_color?: string | null id?: string - is_deleted?: boolean - is_featured?: boolean - is_public?: boolean name: string - share_expires_at?: string | null - share_token?: string | null + ramo?: string | null updated_at?: string - user_id: string } Update: { - client_id?: string | null - client_name?: string | null created_at?: string - description?: string | null - icon?: string | null - icon_color?: string | null id?: string - is_deleted?: boolean - is_featured?: boolean - is_public?: boolean name?: string - share_expires_at?: string | null - share_token?: string | null + ramo?: string | null updated_at?: string - user_id?: string } Relationships: [] } - comparison_reactions: { + bot_detection_log: { Row: { - anon_id: string - comparison_id: string + action_taken: string + blocked: boolean created_at: string - emoji: string + detection_type: string id: string - ip_hash: string | null - item_index: number + ip_address: string + metadata: Json | null + score: number | null user_agent: string | null } Insert: { - anon_id: string - comparison_id: string + action_taken?: string + blocked?: boolean created_at?: string - emoji: string + detection_type: string id?: string - ip_hash?: string | null - item_index?: number + ip_address: string + metadata?: Json | null + score?: number | null user_agent?: string | null } Update: { - anon_id?: string - comparison_id?: string + action_taken?: string + blocked?: boolean created_at?: string - emoji?: string + detection_type?: string id?: string - ip_hash?: string | null - item_index?: number + ip_address?: string + metadata?: Json | null + score?: number | null user_agent?: string | null } - Relationships: [ - { - foreignKeyName: "comparison_reactions_comparison_id_fkey" - columns: ["comparison_id"] - isOneToOne: false - referencedRelation: "user_comparisons" - referencedColumns: ["id"] - }, - ] + Relationships: [] } - component_media: { + cart_templates: { Row: { - component_id: string created_at: string + description: string | null id: string - is_cover: boolean | null - media_type: string - product_id: string - sort_order: number | null - title: string | null + items: Json + name: string updated_at: string - url: string + user_id: string } Insert: { - component_id: string created_at?: string + description?: string | null id?: string - is_cover?: boolean | null - media_type?: string - product_id: string - sort_order?: number | null - title?: string | null + items?: Json + name: string updated_at?: string - url: string + user_id: string } Update: { - component_id?: string created_at?: string + description?: string | null id?: string - is_cover?: boolean | null - media_type?: string - product_id?: string - sort_order?: number | null - title?: string | null + items?: Json + name?: string updated_at?: string - url?: string + user_id?: string } Relationships: [] } - connection_test_history: { + categories: { Row: { - attempts: number - connection_id: string + active: boolean | null + ai_summary: string | null + bitrix_id: number | null + bitrix_modified_at: string | null + children_count: number | null + color_hex: string | null created_at: string - dns_ms: number | null - download_ms: number | null - error_kind: string | null - error_message: string | null + created_by: string | null + deleted_at: string | null + descendants_count: number | null + description: string | null + display_order: number | null + full_path_readable: string | null + icon: string | null id: string - latency_ms: number | null - request_method: string | null - request_url: string | null - response_body: string | null - response_headers: Json | null - status_code: number | null - success: boolean - tcp_ms: number | null - tested_at: string - tls_ms: number | null - triggered_by: string - triggered_by_user_id: string | null - ttfb_ms: number | null + image_url: string | null + is_active: boolean | null + is_visible: boolean | null + level: number + meta_description: string | null + meta_keywords: string[] | null + meta_title: string | null + min_order_quantity: number | null + name: string + organization_id: string | null + parent_id: string | null + path: string | null + products_count: number | null + schema_json: Json | null + seo_priority: number | null + slug: string | null + sort_order: number | null + sync_status: string | null + synced_at: string | null + updated_at: string | null + updated_by: string | null } Insert: { - attempts?: number - connection_id: string + active?: boolean | null + ai_summary?: string | null + bitrix_id?: number | null + bitrix_modified_at?: string | null + children_count?: number | null + color_hex?: string | null created_at?: string - dns_ms?: number | null - download_ms?: number | null - error_kind?: string | null - error_message?: string | null + created_by?: string | null + deleted_at?: string | null + descendants_count?: number | null + description?: string | null + display_order?: number | null + full_path_readable?: string | null + icon?: string | null id?: string - latency_ms?: number | null - request_method?: string | null - request_url?: string | null - response_body?: string | null - response_headers?: Json | null - status_code?: number | null - success?: boolean - tcp_ms?: number | null - tested_at?: string - tls_ms?: number | null - triggered_by?: string - triggered_by_user_id?: string | null - ttfb_ms?: number | null + image_url?: string | null + is_active?: boolean | null + is_visible?: boolean | null + level?: number + meta_description?: string | null + meta_keywords?: string[] | null + meta_title?: string | null + min_order_quantity?: number | null + name: string + organization_id?: string | null + parent_id?: string | null + path?: string | null + products_count?: number | null + schema_json?: Json | null + seo_priority?: number | null + slug?: string | null + sort_order?: number | null + sync_status?: string | null + synced_at?: string | null + updated_at?: string | null + updated_by?: string | null } Update: { - attempts?: number - connection_id?: string + active?: boolean | null + ai_summary?: string | null + bitrix_id?: number | null + bitrix_modified_at?: string | null + children_count?: number | null + color_hex?: string | null created_at?: string - dns_ms?: number | null - download_ms?: number | null - error_kind?: string | null - error_message?: string | null + created_by?: string | null + deleted_at?: string | null + descendants_count?: number | null + description?: string | null + display_order?: number | null + full_path_readable?: string | null + icon?: string | null id?: string - latency_ms?: number | null - request_method?: string | null - request_url?: string | null - response_body?: string | null - response_headers?: Json | null - status_code?: number | null - success?: boolean - tcp_ms?: number | null - tested_at?: string - tls_ms?: number | null - triggered_by?: string - triggered_by_user_id?: string | null - ttfb_ms?: number | null + image_url?: string | null + is_active?: boolean | null + is_visible?: boolean | null + level?: number + meta_description?: string | null + meta_keywords?: string[] | null + meta_title?: string | null + min_order_quantity?: number | null + name?: string + organization_id?: string | null + parent_id?: string | null + path?: string | null + products_count?: number | null + schema_json?: Json | null + seo_priority?: number | null + slug?: string | null + sort_order?: number | null + sync_status?: string | null + synced_at?: string | null + updated_at?: string | null + updated_by?: string | null } Relationships: [ { - foreignKeyName: "connection_test_history_connection_id_fkey" - columns: ["connection_id"] + foreignKeyName: "categories_organization_id_fkey" + columns: ["organization_id"] isOneToOne: false - referencedRelation: "external_connections" + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "categories_parent_id_fkey" + columns: ["parent_id"] + isOneToOne: false + referencedRelation: "categories" referencedColumns: ["id"] }, + { + foreignKeyName: "categories_parent_id_fkey" + columns: ["parent_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "categories_parent_id_fkey" + columns: ["parent_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "categories_parent_id_fkey" + columns: ["parent_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "categories_parent_id_fkey" + columns: ["parent_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "categories_parent_id_fkey" + columns: ["parent_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, ] } - conversation_audit_logs: { + category_accessory_categories: { Row: { - client_info: Json | null - ended_at: string | null + accessory_category_id: string + category_id: string + created_at: string | null + display_label: string | null + display_order: number | null id: string - metadata: Json | null - session_id: string - started_at: string - status: string - total_tokens_estimated: number | null - user_id: string + include_children: boolean | null + is_active: boolean + is_required: boolean | null + relationship_type: string + updated_at: string | null } Insert: { - client_info?: Json | null - ended_at?: string | null + accessory_category_id: string + category_id: string + created_at?: string | null + display_label?: string | null + display_order?: number | null id?: string - metadata?: Json | null - session_id: string - started_at?: string - status?: string - total_tokens_estimated?: number | null - user_id: string + include_children?: boolean | null + is_active?: boolean + is_required?: boolean | null + relationship_type?: string + updated_at?: string | null } Update: { - client_info?: Json | null - ended_at?: string | null + accessory_category_id?: string + category_id?: string + created_at?: string | null + display_label?: string | null + display_order?: number | null id?: string - metadata?: Json | null - session_id?: string - started_at?: string - status?: string - total_tokens_estimated?: number | null - user_id?: string + include_children?: boolean | null + is_active?: boolean + is_required?: boolean | null + relationship_type?: string + updated_at?: string | null } - Relationships: [] + Relationships: [ + { + foreignKeyName: "category_accessory_categories_accessory_category_id_fkey" + columns: ["accessory_category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "category_accessory_categories_accessory_category_id_fkey" + columns: ["accessory_category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_accessory_categories_accessory_category_id_fkey" + columns: ["accessory_category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_accessory_categories_accessory_category_id_fkey" + columns: ["accessory_category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "category_accessory_categories_accessory_category_id_fkey" + columns: ["accessory_category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "category_accessory_categories_accessory_category_id_fkey" + columns: ["accessory_category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_accessory_categories_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "category_accessory_categories_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_accessory_categories_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_accessory_categories_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "category_accessory_categories_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "category_accessory_categories_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + ] } - conversation_delivery_status: { + category_attributes: { Row: { - error_details: string | null - event_id: string + attribute_key: string + attribute_type: string | null + attribute_value: string | null + category_id: string + created_at: string | null + display_order: number | null id: string - status: string - updated_at: string + is_filterable: boolean | null + updated_at: string | null } Insert: { - error_details?: string | null - event_id: string + attribute_key: string + attribute_type?: string | null + attribute_value?: string | null + category_id: string + created_at?: string | null + display_order?: number | null id?: string - status?: string - updated_at?: string + is_filterable?: boolean | null + updated_at?: string | null } Update: { - error_details?: string | null - event_id?: string + attribute_key?: string + attribute_type?: string | null + attribute_value?: string | null + category_id?: string + created_at?: string | null + display_order?: number | null id?: string - status?: string - updated_at?: string + is_filterable?: boolean | null + updated_at?: string | null } Relationships: [ { - foreignKeyName: "conversation_delivery_status_event_id_fkey" - columns: ["event_id"] + foreignKeyName: "category_attributes_category_id_fkey" + columns: ["category_id"] isOneToOne: false - referencedRelation: "conversation_event_history" + referencedRelation: "categories" referencedColumns: ["id"] }, - ] - } - conversation_event_history: { - Row: { - content: string | null - conversation_id: string - created_at: string - event_type: Database["public"]["Enums"]["conversation_event_type"] - id: string - media_metadata: Json | null - media_url: string | null - request_id: string | null - role: string - tokens_estimated: number | null + { + foreignKeyName: "category_attributes_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_attributes_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_attributes_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "category_attributes_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "category_attributes_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + ] + } + category_colors: { + Row: { + category_id: string + color_group_id: string + created_at: string | null + display_order: number | null + id: string + is_active: boolean | null + is_primary: boolean | null + updated_at: string | null } Insert: { - content?: string | null - conversation_id: string - created_at?: string - event_type?: Database["public"]["Enums"]["conversation_event_type"] + category_id: string + color_group_id: string + created_at?: string | null + display_order?: number | null id?: string - media_metadata?: Json | null - media_url?: string | null - request_id?: string | null - role: string - tokens_estimated?: number | null + is_active?: boolean | null + is_primary?: boolean | null + updated_at?: string | null } Update: { - content?: string | null - conversation_id?: string - created_at?: string - event_type?: Database["public"]["Enums"]["conversation_event_type"] + category_id?: string + color_group_id?: string + created_at?: string | null + display_order?: number | null id?: string - media_metadata?: Json | null - media_url?: string | null - request_id?: string | null - role?: string - tokens_estimated?: number | null + is_active?: boolean | null + is_primary?: boolean | null + updated_at?: string | null } Relationships: [ { - foreignKeyName: "conversation_event_history_conversation_id_fkey" - columns: ["conversation_id"] + foreignKeyName: "fk_category_colors_category" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_category_colors_category" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "fk_category_colors_category" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "fk_category_colors_category" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "fk_category_colors_category" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "fk_category_colors_category" + columns: ["category_id"] isOneToOne: false - referencedRelation: "conversation_audit_logs" + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "fk_category_colors_color_group" + columns: ["color_group_id"] + isOneToOne: false + referencedRelation: "color_groups" referencedColumns: ["id"] }, + { + foreignKeyName: "fk_category_colors_color_group" + columns: ["color_group_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["promo_group_id"] + }, ] } - custom_kits: { + category_commemorative_dates: { Row: { - box_data: Json | null - box_price: number - color: string + category_id: string + commemorative_date_id: string + created_at: string | null + custom_message: string | null + display_order: number | null + id: string + is_active: boolean + is_primary: boolean | null + relevance_score: number | null + updated_at: string | null + } + Insert: { + category_id: string + commemorative_date_id: string + created_at?: string | null + custom_message?: string | null + display_order?: number | null + id?: string + is_active?: boolean + is_primary?: boolean | null + relevance_score?: number | null + updated_at?: string | null + } + Update: { + category_id?: string + commemorative_date_id?: string + created_at?: string | null + custom_message?: string | null + display_order?: number | null + id?: string + is_active?: boolean + is_primary?: boolean | null + relevance_score?: number | null + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "category_commemorative_dates_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "category_commemorative_dates_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_commemorative_dates_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_commemorative_dates_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "category_commemorative_dates_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "category_commemorative_dates_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "commemorative_dates" + referencedColumns: ["id"] + }, + { + foreignKeyName: "category_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "v_commemorative_dates_calendar" + referencedColumns: ["id"] + }, + { + foreignKeyName: "category_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "v_commemorative_dates_with_colors" + referencedColumns: ["id"] + }, + { + foreignKeyName: "category_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["commemorative_date_id"] + }, + { + foreignKeyName: "category_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["date_id"] + }, + { + foreignKeyName: "category_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["date_id"] + }, + { + foreignKeyName: "category_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["date_id"] + }, + ] + } + category_copywriting_config: { + Row: { + beneficios_emocionais: string[] | null + category_id: string + config_extra: Json | null + created_at: string | null + created_by: string | null + ctas: string[] | null + diferenciais: string[] | null + id: string + is_active: boolean | null + keywords_seo: string[] | null + objecoes_comuns: string[] | null + ocasioes: string[] | null + personas: string[] | null + storytelling_template: string | null + tom_voz: string | null + unidade_capacidade: string | null + unidade_dimensao: string | null + unidade_peso: string | null + updated_at: string | null + updated_by: string | null + } + Insert: { + beneficios_emocionais?: string[] | null + category_id: string + config_extra?: Json | null + created_at?: string | null + created_by?: string | null + ctas?: string[] | null + diferenciais?: string[] | null + id?: string + is_active?: boolean | null + keywords_seo?: string[] | null + objecoes_comuns?: string[] | null + ocasioes?: string[] | null + personas?: string[] | null + storytelling_template?: string | null + tom_voz?: string | null + unidade_capacidade?: string | null + unidade_dimensao?: string | null + unidade_peso?: string | null + updated_at?: string | null + updated_by?: string | null + } + Update: { + beneficios_emocionais?: string[] | null + category_id?: string + config_extra?: Json | null + created_at?: string | null + created_by?: string | null + ctas?: string[] | null + diferenciais?: string[] | null + id?: string + is_active?: boolean | null + keywords_seo?: string[] | null + objecoes_comuns?: string[] | null + ocasioes?: string[] | null + personas?: string[] | null + storytelling_template?: string | null + tom_voz?: string | null + unidade_capacidade?: string | null + unidade_dimensao?: string | null + unidade_peso?: string | null + updated_at?: string | null + updated_by?: string | null + } + Relationships: [ + { + foreignKeyName: "category_copywriting_config_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "category_copywriting_config_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_copywriting_config_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_copywriting_config_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "category_copywriting_config_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "category_copywriting_config_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + ] + } + category_icons: { + Row: { + category_name: string created_at: string description: string | null icon: string id: string - is_favorite: boolean - is_pinned: boolean - items_data: Json - items_price: number - kit_quantity: number - kit_type: string - last_used_at: string | null - name: string - organization_id: string | null - personalization_data: Json - personalization_price: number - status: string - tag: string | null - total_price: number + is_active: boolean updated_at: string - user_id: string - volume_usage_percent: number } Insert: { - box_data?: Json | null - box_price?: number - color?: string + category_name: string created_at?: string description?: string | null - icon?: string + icon: string id?: string - is_favorite?: boolean - is_pinned?: boolean - items_data?: Json - items_price?: number - kit_quantity?: number - kit_type?: string - last_used_at?: string | null - name?: string - organization_id?: string | null - personalization_data?: Json - personalization_price?: number - status?: string - tag?: string | null - total_price?: number + is_active?: boolean updated_at?: string - user_id: string - volume_usage_percent?: number } Update: { - box_data?: Json | null - box_price?: number - color?: string + category_name?: string created_at?: string description?: string | null icon?: string id?: string - is_favorite?: boolean - is_pinned?: boolean - items_data?: Json - items_price?: number - kit_quantity?: number - kit_type?: string - last_used_at?: string | null - name?: string - organization_id?: string | null - personalization_data?: Json - personalization_price?: number - status?: string - tag?: string | null - total_price?: number + is_active?: boolean updated_at?: string - user_id?: string - volume_usage_percent?: number } Relationships: [] } - discount_approval_requests: { + category_relationships: { Row: { - admin_id: string | null - admin_notes: string | null - created_at: string + child_bitrix_id: number + child_id: string + child_name: string + created_at: string | null + depth: number id: string - max_allowed_percent: number - quote_id: string - quote_snapshot_hash: string | null - requested_discount_percent: number - responded_at: string | null - seller_id: string - seller_notes: string | null - status: string - updated_at: string - valid_until: string | null + organization_id: string + parent_bitrix_id: number + parent_id: string + parent_name: string } Insert: { - admin_id?: string | null - admin_notes?: string | null - created_at?: string + child_bitrix_id: number + child_id: string + child_name: string + created_at?: string | null + depth: number id?: string - max_allowed_percent: number - quote_id: string - quote_snapshot_hash?: string | null - requested_discount_percent: number - responded_at?: string | null - seller_id: string - seller_notes?: string | null - status?: string - updated_at?: string - valid_until?: string | null + organization_id: string + parent_bitrix_id: number + parent_id: string + parent_name: string } Update: { - admin_id?: string | null - admin_notes?: string | null - created_at?: string + child_bitrix_id?: number + child_id?: string + child_name?: string + created_at?: string | null + depth?: number id?: string - max_allowed_percent?: number - quote_id?: string - quote_snapshot_hash?: string | null - requested_discount_percent?: number - responded_at?: string | null - seller_id?: string - seller_notes?: string | null - status?: string - updated_at?: string - valid_until?: string | null + organization_id?: string + parent_bitrix_id?: number + parent_id?: string + parent_name?: string + } + Relationships: [] + } + category_target_audiences: { + Row: { + category_id: string + created_at: string | null + display_order: number | null + id: string + is_active: boolean + is_primary: boolean | null + relevance_score: number | null + target_audience_id: string + updated_at: string | null + } + Insert: { + category_id: string + created_at?: string | null + display_order?: number | null + id?: string + is_active?: boolean + is_primary?: boolean | null + relevance_score?: number | null + target_audience_id: string + updated_at?: string | null + } + Update: { + category_id?: string + created_at?: string | null + display_order?: number | null + id?: string + is_active?: boolean + is_primary?: boolean | null + relevance_score?: number | null + target_audience_id?: string + updated_at?: string | null } Relationships: [ { - foreignKeyName: "discount_approval_requests_quote_id_fkey" - columns: ["quote_id"] + foreignKeyName: "category_target_audiences_category_id_fkey" + columns: ["category_id"] isOneToOne: false - referencedRelation: "quotes" + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "category_target_audiences_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_target_audiences_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_target_audiences_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "category_target_audiences_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "category_target_audiences_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_target_audiences_target_audience_id_fkey" + columns: ["target_audience_id"] + isOneToOne: false + referencedRelation: "target_audiences" referencedColumns: ["id"] }, ] } - e2e_cleanup_audit: { + category_variation_types: { Row: { - created_at: string - deleted_by_table: Json - dry_run: boolean - duration_ms: number - email: string - errors: Json + category_id: string + created_at: string | null + display_order: number | null id: string - ip: string | null - name_filter_prefix: string | null - reason: string | null - seller_id: string | null - seller_scope: string | null - status: string - total_deleted: number - user_agent: string | null - user_id: string | null + inherit_from_parent: boolean | null + is_active: boolean | null + is_required: boolean | null + updated_at: string | null + variation_type_id: string } Insert: { - created_at?: string - deleted_by_table?: Json - dry_run?: boolean - duration_ms?: number - email: string - errors?: Json + category_id: string + created_at?: string | null + display_order?: number | null id?: string - ip?: string | null - name_filter_prefix?: string | null - reason?: string | null - seller_id?: string | null - seller_scope?: string | null - status: string - total_deleted?: number - user_agent?: string | null - user_id?: string | null + inherit_from_parent?: boolean | null + is_active?: boolean | null + is_required?: boolean | null + updated_at?: string | null + variation_type_id: string } Update: { - created_at?: string - deleted_by_table?: Json - dry_run?: boolean - duration_ms?: number - email?: string - errors?: Json + category_id?: string + created_at?: string | null + display_order?: number | null id?: string - ip?: string | null - name_filter_prefix?: string | null - reason?: string | null - seller_id?: string | null - seller_scope?: string | null - status?: string - total_deleted?: number - user_agent?: string | null - user_id?: string | null + inherit_from_parent?: boolean | null + is_active?: boolean | null + is_required?: boolean | null + updated_at?: string | null + variation_type_id?: string } - Relationships: [] + Relationships: [ + { + foreignKeyName: "category_variation_types_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "category_variation_types_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_variation_types_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_variation_types_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "category_variation_types_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "category_variation_types_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_variation_types_variation_type_id_fkey" + columns: ["variation_type_id"] + isOneToOne: false + referencedRelation: "variation_types" + referencedColumns: ["id"] + }, + ] } - e2e_cleanup_rate_limit: { + city_whitelist: { Row: { - count: number - key: string - updated_at: string - window_start: string + city_name: string + country_code: string + created_at: string + id: string + is_active: boolean + state: string | null } Insert: { - count?: number - key: string - updated_at?: string - window_start?: string + city_name: string + country_code?: string + created_at?: string + id?: string + is_active?: boolean + state?: string | null } Update: { - count?: number - key?: string - updated_at?: string - window_start?: string + city_name?: string + country_code?: string + created_at?: string + id?: string + is_active?: boolean + state?: string | null } Relationships: [] } - edge_rate_limits: { + classify_functions_registry: { Row: { - count: number - created_at: string | null - key: string - reset_at: string - updated_at: string | null + created_at: string + description: string | null + function_name: string + id: number + is_active: boolean + is_field: string + priority: number + updated_at: string } Insert: { - count?: number - created_at?: string | null - key: string - reset_at: string - updated_at?: string | null + created_at?: string + description?: string | null + function_name: string + id?: number + is_active?: boolean + is_field: string + priority?: number + updated_at?: string } Update: { - count?: number - created_at?: string | null - key?: string - reset_at?: string - updated_at?: string | null + created_at?: string + description?: string | null + function_name?: string + id?: number + is_active?: boolean + is_field?: string + priority?: number + updated_at?: string } Relationships: [] } - expert_conversations: { + collection_item_reactions: { Row: { - client_id: string | null + anon_id: string + collection_id: string created_at: string + emoji: string id: string - seller_id: string - title: string - updated_at: string + ip_hash: string | null + item_id: string + user_agent: string | null } Insert: { - client_id?: string | null + anon_id: string + collection_id: string created_at?: string + emoji: string id?: string - seller_id: string - title?: string - updated_at?: string + ip_hash?: string | null + item_id: string + user_agent?: string | null } Update: { - client_id?: string | null + anon_id?: string + collection_id?: string created_at?: string + emoji?: string id?: string - seller_id?: string - title?: string - updated_at?: string + ip_hash?: string | null + item_id?: string + user_agent?: string | null } Relationships: [] } - expert_messages: { + collection_items: { Row: { - content: string - conversation_id: string + added_at: string + collection_id: string + color_hex: string | null + color_name: string | null created_at: string id: string - role: string + notes: string | null + price_at_save: number | null + product_id: string + sort_order: number | null + thumbnail_url: string | null } Insert: { - content: string - conversation_id: string + added_at?: string + collection_id: string + color_hex?: string | null + color_name?: string | null created_at?: string id?: string - role?: string + notes?: string | null + price_at_save?: number | null + product_id: string + sort_order?: number | null + thumbnail_url?: string | null } Update: { - content?: string - conversation_id?: string + added_at?: string + collection_id?: string + color_hex?: string | null + color_name?: string | null created_at?: string id?: string - role?: string - } - Relationships: [ - { - foreignKeyName: "expert_messages_conversation_id_fkey" - columns: ["conversation_id"] - isOneToOne: false - referencedRelation: "expert_conversations" - referencedColumns: ["id"] - }, - ] - } - external_connections: { - Row: { - auto_test_enabled: boolean - config: Json - created_at: string - created_by: string - env_key: string | null - id: string - last_latency_ms: number | null - last_test_at: string | null - last_test_message: string | null - last_test_ok: boolean | null - name: string - secret_refs: string[] - status: string - type: string - updated_at: string - } - Insert: { - auto_test_enabled?: boolean - config?: Json - created_at?: string - created_by: string - env_key?: string | null - id?: string - last_latency_ms?: number | null - last_test_at?: string | null - last_test_message?: string | null - last_test_ok?: boolean | null - name: string - secret_refs?: string[] - status?: string - type: string - updated_at?: string - } - Update: { - auto_test_enabled?: boolean - config?: Json - created_at?: string - created_by?: string - env_key?: string | null - id?: string - last_latency_ms?: number | null - last_test_at?: string | null - last_test_message?: string | null - last_test_ok?: boolean | null - name?: string - secret_refs?: string[] - status?: string - type?: string - updated_at?: string - } - Relationships: [] - } - external_connections_sync_log: { - Row: { - completed_at: string | null - connection_id: string | null - connection_name: string - duration_ms: number | null - error_message: string | null - id: string - metadata: Json | null - records_failed: number | null - records_processed: number | null - started_at: string - status: string - sync_type: string - } - Insert: { - completed_at?: string | null - connection_id?: string | null - connection_name: string - duration_ms?: number | null - error_message?: string | null - id?: string - metadata?: Json | null - records_failed?: number | null - records_processed?: number | null - started_at?: string - status?: string - sync_type?: string - } - Update: { - completed_at?: string | null - connection_id?: string | null - connection_name?: string - duration_ms?: number | null - error_message?: string | null - id?: string - metadata?: Json | null - records_failed?: number | null - records_processed?: number | null - started_at?: string - status?: string - sync_type?: string - } - Relationships: [] - } - favorite_item_reactions: { - Row: { - anon_id: string - created_at: string - emoji: string - id: string - ip_hash: string | null - item_id: string - list_id: string - user_agent: string | null - } - Insert: { - anon_id: string - created_at?: string - emoji: string - id?: string - ip_hash?: string | null - item_id: string - list_id: string - user_agent?: string | null - } - Update: { - anon_id?: string - created_at?: string - emoji?: string - id?: string - ip_hash?: string | null - item_id?: string - list_id?: string - user_agent?: string | null - } - Relationships: [ - { - foreignKeyName: "favorite_item_reactions_item_id_fkey" - columns: ["item_id"] - isOneToOne: false - referencedRelation: "favorite_items" - referencedColumns: ["id"] - }, - { - foreignKeyName: "favorite_item_reactions_list_id_fkey" - columns: ["list_id"] - isOneToOne: false - referencedRelation: "favorite_lists" - referencedColumns: ["id"] - }, - ] - } - favorite_items: { - Row: { - added_at: string - id: string - list_id: string - note: string | null - position: number - price_at_save: number | null - product_id: string - updated_at: string - user_id: string - variant_id: string | null - variant_info: Json | null - } - Insert: { - added_at?: string - id?: string - list_id: string - note?: string | null - position?: number - price_at_save?: number | null - product_id: string - updated_at?: string - user_id: string - variant_id?: string | null - variant_info?: Json | null - } - Update: { - added_at?: string - id?: string - list_id?: string - note?: string | null - position?: number + notes?: string | null price_at_save?: number | null product_id?: string - updated_at?: string - user_id?: string - variant_id?: string | null - variant_info?: Json | null + sort_order?: number | null + thumbnail_url?: string | null } Relationships: [ { - foreignKeyName: "favorite_items_list_id_fkey" - columns: ["list_id"] + foreignKeyName: "collection_items_collection_id_fkey" + columns: ["collection_id"] isOneToOne: false - referencedRelation: "favorite_lists" + referencedRelation: "collections" referencedColumns: ["id"] }, ] } - favorite_items_trash: { + collection_items_trash: { Row: { - added_at: string | null + collection_id: string + color_hex: string | null + color_name: string | null deleted_at: string expires_at: string id: string - list_id: string - note: string | null + notes: string | null original_id: string - position: number | null price_at_save: number | null product_id: string + sort_order: number | null + thumbnail_url: string | null user_id: string - variant_id: string | null - variant_info: Json | null } Insert: { - added_at?: string | null + collection_id: string + color_hex?: string | null + color_name?: string | null deleted_at?: string expires_at?: string id?: string - list_id: string - note?: string | null + notes?: string | null original_id: string - position?: number | null price_at_save?: number | null product_id: string + sort_order?: number | null + thumbnail_url?: string | null user_id: string - variant_id?: string | null - variant_info?: Json | null } Update: { - added_at?: string | null + collection_id?: string + color_hex?: string | null + color_name?: string | null deleted_at?: string expires_at?: string id?: string - list_id?: string - note?: string | null + notes?: string | null original_id?: string - position?: number | null price_at_save?: number | null product_id?: string + sort_order?: number | null + thumbnail_url?: string | null user_id?: string - variant_id?: string | null - variant_info?: Json | null } Relationships: [] } - favorite_lists: { + collection_products: { Row: { - client_id: string | null - client_name: string | null - color: string + collection_id: string created_at: string - description: string | null - icon: string + display_order: number id: string - is_archived: boolean - is_default: boolean - name: string - position: number - shared_expires_at: string | null - shared_token: string | null - updated_at: string - user_id: string + product_id: string } Insert: { - client_id?: string | null - client_name?: string | null - color?: string + collection_id: string created_at?: string - description?: string | null - icon?: string + display_order?: number id?: string - is_archived?: boolean - is_default?: boolean - name?: string - position?: number - shared_expires_at?: string | null - shared_token?: string | null - updated_at?: string - user_id: string + product_id: string } Update: { - client_id?: string | null - client_name?: string | null - color?: string + collection_id?: string created_at?: string - description?: string | null - icon?: string + display_order?: number id?: string - is_archived?: boolean - is_default?: boolean - name?: string - position?: number - shared_expires_at?: string | null - shared_token?: string | null - updated_at?: string - user_id?: string + product_id?: string } - Relationships: [] + Relationships: [ + { + foreignKeyName: "collection_products_collection_id_fkey" + columns: ["collection_id"] + isOneToOne: false + referencedRelation: "collections" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "collection_products_product_id_fkey1" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] } - file_scan_logs: { + collections: { Row: { + client_id: string | null + client_name: string | null created_at: string - file_hash: string | null - file_name: string - file_size: number | null + description: string | null + icon: string | null + icon_color: string | null id: string - mime_type: string | null - scan_provider: string - scan_response: Json | null - scan_result: string - storage_path: string | null + is_deleted: boolean + is_featured: boolean + is_public: boolean + name: string + share_expires_at: string | null + share_token: string | null + updated_at: string user_id: string } Insert: { + client_id?: string | null + client_name?: string | null created_at?: string - file_hash?: string | null - file_name: string - file_size?: number | null + description?: string | null + icon?: string | null + icon_color?: string | null id?: string - mime_type?: string | null - scan_provider?: string - scan_response?: Json | null - scan_result?: string - storage_path?: string | null + is_deleted?: boolean + is_featured?: boolean + is_public?: boolean + name: string + share_expires_at?: string | null + share_token?: string | null + updated_at?: string user_id: string } Update: { + client_id?: string | null + client_name?: string | null created_at?: string - file_hash?: string | null - file_name?: string - file_size?: number | null + description?: string | null + icon?: string | null + icon_color?: string | null id?: string - mime_type?: string | null - scan_provider?: string - scan_response?: Json | null - scan_result?: string - storage_path?: string | null + is_deleted?: boolean + is_featured?: boolean + is_public?: boolean + name?: string + share_expires_at?: string | null + share_token?: string | null + updated_at?: string user_id?: string } Relationships: [] } - follow_up_reminders: { + color_analysis_staging: { Row: { - completed_at: string | null - created_at: string + approved: boolean | null + blue_pixel_count: number | null + current_variation_id: string | null + current_variation_name: string | null + detected_hex: string | null + detected_rgb_b: number | null + detected_rgb_g: number | null + detected_rgb_r: number | null id: string - is_completed: boolean - is_sent: boolean - notes: string | null - quote_id: string - reminder_type: string - scheduled_for: string - seller_id: string - sent_at: string | null - title: string | null + image_url: string + match_distance: number | null + needs_review: boolean | null + organization_id: string | null + processed_at: string | null + product_sku: string | null + reviewed: boolean | null + suggested_hex: string | null + suggested_variation_id: string | null + suggested_variation_name: string | null + supplier_color_name: string | null + total_pixel_count: number | null + variant_id: string + variant_sku: string | null } Insert: { - completed_at?: string | null - created_at?: string - id?: string - is_completed?: boolean - is_sent?: boolean - notes?: string | null - quote_id: string - reminder_type?: string - scheduled_for: string - seller_id: string - sent_at?: string | null - title?: string | null + approved?: boolean | null + blue_pixel_count?: number | null + current_variation_id?: string | null + current_variation_name?: string | null + detected_hex?: string | null + detected_rgb_b?: number | null + detected_rgb_g?: number | null + detected_rgb_r?: number | null + id?: string + image_url: string + match_distance?: number | null + needs_review?: boolean | null + organization_id?: string | null + processed_at?: string | null + product_sku?: string | null + reviewed?: boolean | null + suggested_hex?: string | null + suggested_variation_id?: string | null + suggested_variation_name?: string | null + supplier_color_name?: string | null + total_pixel_count?: number | null + variant_id: string + variant_sku?: string | null } Update: { - completed_at?: string | null - created_at?: string - id?: string - is_completed?: boolean - is_sent?: boolean - notes?: string | null - quote_id?: string - reminder_type?: string - scheduled_for?: string - seller_id?: string - sent_at?: string | null - title?: string | null - } - Relationships: [] - } - frontend_telemetry: { - Row: { - created_at: string - duration_ms: number | null - event_type: string - id: string - metadata: Json | null - name: string - session_id: string | null - url: string | null - user_agent: string | null - user_id: string | null + approved?: boolean | null + blue_pixel_count?: number | null + current_variation_id?: string | null + current_variation_name?: string | null + detected_hex?: string | null + detected_rgb_b?: number | null + detected_rgb_g?: number | null + detected_rgb_r?: number | null + id?: string + image_url?: string + match_distance?: number | null + needs_review?: boolean | null + organization_id?: string | null + processed_at?: string | null + product_sku?: string | null + reviewed?: boolean | null + suggested_hex?: string | null + suggested_variation_id?: string | null + suggested_variation_name?: string | null + supplier_color_name?: string | null + total_pixel_count?: number | null + variant_id?: string + variant_sku?: string | null } - Insert: { - created_at?: string - duration_ms?: number | null - event_type: string - id?: string - metadata?: Json | null - name: string - session_id?: string | null - url?: string | null - user_agent?: string | null - user_id?: string | null - } - Update: { - created_at?: string - duration_ms?: number | null - event_type?: string - id?: string - metadata?: Json | null - name?: string - session_id?: string | null - url?: string | null - user_agent?: string | null - user_id?: string | null - } - Relationships: [] + Relationships: [ + { + foreignKeyName: "color_analysis_staging_current_variation_id_fkey" + columns: ["current_variation_id"] + isOneToOne: false + referencedRelation: "color_variations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "color_analysis_staging_current_variation_id_fkey" + columns: ["current_variation_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["promo_variation_id"] + }, + { + foreignKeyName: "color_analysis_staging_suggested_variation_id_fkey" + columns: ["suggested_variation_id"] + isOneToOne: false + referencedRelation: "color_variations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "color_analysis_staging_suggested_variation_id_fkey" + columns: ["suggested_variation_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["promo_variation_id"] + }, + { + foreignKeyName: "color_analysis_staging_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "product_variants" + referencedColumns: ["id"] + }, + { + foreignKeyName: "color_analysis_staging_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "color_analysis_staging_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "color_analysis_staging_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_variant_sale_prices" + referencedColumns: ["variant_id"] + }, + ] } - generated_mockups: { + color_equivalences: { Row: { - ai_model_used: string - approval_status: string | null - approved_at: string | null - approved_by_user_id: string | null - area_config: Json - area_name: string - client_feedback: string | null - created_at: string - error_details: string | null - generation_cost: number | null - generation_time_seconds: number | null - has_errors: boolean | null + confidence_score: number | null + created_at: string | null id: string - job_id: string - logo_url: string - mockup_url: string - product_color_hex: string - product_color_name: string | null - product_id: string | null - product_name: string - product_sku: string | null - prompt_used: string | null - quality_score: number | null - seed_used: number | null - technique_id: string | null - technique_name: string - thumbnail_url: string | null - updated_at: string - user_id: string + is_active: boolean | null + match_quality: string | null + notes: string | null + organization_id: string + promo_nuance_id: string | null + promo_variation_id: string + source: string | null + supplier_color_id: string + updated_at: string | null + verified: boolean | null + verified_at: string | null + verified_by: string | null } Insert: { - ai_model_used: string - approval_status?: string | null - approved_at?: string | null - approved_by_user_id?: string | null - area_config: Json - area_name: string - client_feedback?: string | null - created_at?: string - error_details?: string | null - generation_cost?: number | null - generation_time_seconds?: number | null - has_errors?: boolean | null + confidence_score?: number | null + created_at?: string | null id?: string - job_id: string - logo_url: string - mockup_url: string - product_color_hex: string - product_color_name?: string | null - product_id?: string | null - product_name: string - product_sku?: string | null - prompt_used?: string | null - quality_score?: number | null - seed_used?: number | null - technique_id?: string | null - technique_name: string - thumbnail_url?: string | null - updated_at?: string - user_id: string + is_active?: boolean | null + match_quality?: string | null + notes?: string | null + organization_id: string + promo_nuance_id?: string | null + promo_variation_id: string + source?: string | null + supplier_color_id: string + updated_at?: string | null + verified?: boolean | null + verified_at?: string | null + verified_by?: string | null } Update: { - ai_model_used?: string - approval_status?: string | null - approved_at?: string | null - approved_by_user_id?: string | null - area_config?: Json - area_name?: string - client_feedback?: string | null - created_at?: string - error_details?: string | null - generation_cost?: number | null - generation_time_seconds?: number | null - has_errors?: boolean | null + confidence_score?: number | null + created_at?: string | null id?: string - job_id?: string - logo_url?: string - mockup_url?: string - product_color_hex?: string - product_color_name?: string | null - product_id?: string | null - product_name?: string - product_sku?: string | null - prompt_used?: string | null - quality_score?: number | null - seed_used?: number | null - technique_id?: string | null - technique_name?: string - thumbnail_url?: string | null - updated_at?: string - user_id?: string + is_active?: boolean | null + match_quality?: string | null + notes?: string | null + organization_id?: string + promo_nuance_id?: string | null + promo_variation_id?: string + source?: string | null + supplier_color_id?: string + updated_at?: string | null + verified?: boolean | null + verified_at?: string | null + verified_by?: string | null } - Relationships: [] + Relationships: [ + { + foreignKeyName: "color_equivalences_promo_nuance_id_fkey" + columns: ["promo_nuance_id"] + isOneToOne: false + referencedRelation: "color_nuances" + referencedColumns: ["id"] + }, + { + foreignKeyName: "color_equivalences_promo_variation_id_fkey" + columns: ["promo_variation_id"] + isOneToOne: false + referencedRelation: "color_variations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "color_equivalences_promo_variation_id_fkey" + columns: ["promo_variation_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["promo_variation_id"] + }, + { + foreignKeyName: "color_equivalences_supplier_color_id_fkey" + columns: ["supplier_color_id"] + isOneToOne: false + referencedRelation: "supplier_colors" + referencedColumns: ["id"] + }, + { + foreignKeyName: "color_equivalences_supplier_color_id_fkey" + columns: ["supplier_color_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_color_id"] + }, + ] } - geo_allowed_countries: { + color_groups: { Row: { - country_code: string - country_name: string + bitrix_id: number | null created_at: string | null - created_by: string | null + description: string | null + hex_code: string | null id: string + internal_code: string | null is_active: boolean | null + name: string + organization_id: string + slug: string + sort_order: number | null + updated_at: string | null } Insert: { - country_code: string - country_name: string + bitrix_id?: number | null created_at?: string | null - created_by?: string | null + description?: string | null + hex_code?: string | null id?: string + internal_code?: string | null is_active?: boolean | null + name: string + organization_id: string + slug: string + sort_order?: number | null + updated_at?: string | null } Update: { - country_code?: string - country_name?: string + bitrix_id?: number | null created_at?: string | null - created_by?: string | null + description?: string | null + hex_code?: string | null id?: string + internal_code?: string | null is_active?: boolean | null + name?: string + organization_id?: string + slug?: string + sort_order?: number | null + updated_at?: string | null } Relationships: [] } - hardening_health_snapshots: { + color_nuances: { Row: { - created_at: string - details: Json - failures: string[] + bitrix_id: number | null + created_at: string | null + description: string | null id: string - max_score: number - score: number - snapshot_at: string + is_active: boolean | null + name: string + organization_id: string + slug: string + sort_order: number | null + updated_at: string | null } Insert: { - created_at?: string - details?: Json - failures?: string[] + bitrix_id?: number | null + created_at?: string | null + description?: string | null id?: string - max_score?: number - score: number - snapshot_at?: string + is_active?: boolean | null + name: string + organization_id: string + slug: string + sort_order?: number | null + updated_at?: string | null } Update: { - created_at?: string - details?: Json - failures?: string[] + bitrix_id?: number | null + created_at?: string | null + description?: string | null id?: string - max_score?: number - score?: number - snapshot_at?: string + is_active?: boolean | null + name?: string + organization_id?: string + slug?: string + sort_order?: number | null + updated_at?: string | null } Relationships: [] } - inbound_webhook_endpoints: { + color_variations: { Row: { - allowed_events: string[] - allowed_ips: string[] | null - created_at: string - created_by: string + bitrix_id: number | null + color_group_id: string | null + created_at: string | null description: string | null - hmac_secret_ref: string + group_id: string + hex_code: string id: string - is_active: boolean - last_received_at: string | null - metadata: Json | null + image_url: string | null + internal_code: string | null + is_active: boolean | null + is_available: boolean | null name: string - secret_key: string | null + nuance_id: string | null + organization_id: string slug: string - source_system: string - total_invalid: number - total_received: number - updated_at: string + sort_order: number | null + updated_at: string | null + xml_id: string | null } Insert: { - allowed_events?: string[] - allowed_ips?: string[] | null - created_at?: string - created_by: string + bitrix_id?: number | null + color_group_id?: string | null + created_at?: string | null description?: string | null - hmac_secret_ref: string + group_id: string + hex_code: string id?: string - is_active?: boolean - last_received_at?: string | null - metadata?: Json | null + image_url?: string | null + internal_code?: string | null + is_active?: boolean | null + is_available?: boolean | null name: string - secret_key?: string | null + nuance_id?: string | null + organization_id: string slug: string - source_system: string - total_invalid?: number - total_received?: number - updated_at?: string + sort_order?: number | null + updated_at?: string | null + xml_id?: string | null } Update: { - allowed_events?: string[] - allowed_ips?: string[] | null - created_at?: string - created_by?: string + bitrix_id?: number | null + color_group_id?: string | null + created_at?: string | null description?: string | null - hmac_secret_ref?: string + group_id?: string + hex_code?: string id?: string - is_active?: boolean - last_received_at?: string | null - metadata?: Json | null + image_url?: string | null + internal_code?: string | null + is_active?: boolean | null + is_available?: boolean | null name?: string - secret_key?: string | null + nuance_id?: string | null + organization_id?: string slug?: string - source_system?: string - total_invalid?: number - total_received?: number - updated_at?: string - } - Relationships: [] - } - inbound_webhook_events: { - Row: { - created_at: string - endpoint_id: string - error_message: string | null - event_type: string | null - headers: Json | null - id: string - ip_address: string | null - payload: Json | null - processed: boolean - processed_at: string | null - signature_valid: boolean - } - Insert: { - created_at?: string - endpoint_id: string - error_message?: string | null - event_type?: string | null - headers?: Json | null - id?: string - ip_address?: string | null - payload?: Json | null - processed?: boolean - processed_at?: string | null - signature_valid?: boolean - } - Update: { - created_at?: string - endpoint_id?: string - error_message?: string | null - event_type?: string | null - headers?: Json | null - id?: string - ip_address?: string | null - payload?: Json | null - processed?: boolean - processed_at?: string | null - signature_valid?: boolean + sort_order?: number | null + updated_at?: string | null + xml_id?: string | null } Relationships: [ { - foreignKeyName: "inbound_webhook_events_endpoint_id_fkey" - columns: ["endpoint_id"] + foreignKeyName: "color_variations_color_group_id_fkey" + columns: ["color_group_id"] isOneToOne: false - referencedRelation: "inbound_webhook_endpoints" + referencedRelation: "color_groups" + referencedColumns: ["id"] + }, + { + foreignKeyName: "color_variations_color_group_id_fkey" + columns: ["color_group_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["promo_group_id"] + }, + { + foreignKeyName: "color_variations_group_id_fkey" + columns: ["group_id"] + isOneToOne: false + referencedRelation: "color_groups" + referencedColumns: ["id"] + }, + { + foreignKeyName: "color_variations_group_id_fkey" + columns: ["group_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["promo_group_id"] + }, + { + foreignKeyName: "color_variations_nuance_id_fkey" + columns: ["nuance_id"] + isOneToOne: false + referencedRelation: "color_nuances" referencedColumns: ["id"] }, ] } - integration_credentials: { + commemorative_date_colors: { Row: { - created_at: string - created_by: string | null - credential_type: string | null - description: string | null - expires_at: string | null + color_group_id: string + commemorative_date_id: string + created_at: string | null id: string - is_active: boolean | null - length: number | null - masked_suffix: string | null - metadata: Json | null - notes: string | null - provider: string | null - secret_name: string - secret_value: string - updated_at: string - updated_by: string | null + is_primary: boolean | null + match_score: number | null } Insert: { - created_at?: string - created_by?: string | null - credential_type?: string | null - description?: string | null - expires_at?: string | null + color_group_id: string + commemorative_date_id: string + created_at?: string | null id?: string - is_active?: boolean | null - length?: number | null - masked_suffix?: string | null - metadata?: Json | null - notes?: string | null - provider?: string | null - secret_name: string - secret_value: string - updated_at?: string - updated_by?: string | null + is_primary?: boolean | null + match_score?: number | null } Update: { - created_at?: string - created_by?: string | null - credential_type?: string | null - description?: string | null - expires_at?: string | null + color_group_id?: string + commemorative_date_id?: string + created_at?: string | null id?: string - is_active?: boolean | null - length?: number | null - masked_suffix?: string | null - metadata?: Json | null - notes?: string | null - provider?: string | null - secret_name?: string - secret_value?: string - updated_at?: string - updated_by?: string | null + is_primary?: boolean | null + match_score?: number | null } - Relationships: [] + Relationships: [ + { + foreignKeyName: "commemorative_date_colors_color_group_id_fkey" + columns: ["color_group_id"] + isOneToOne: false + referencedRelation: "color_groups" + referencedColumns: ["id"] + }, + { + foreignKeyName: "commemorative_date_colors_color_group_id_fkey" + columns: ["color_group_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["promo_group_id"] + }, + { + foreignKeyName: "commemorative_date_colors_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "commemorative_dates" + referencedColumns: ["id"] + }, + { + foreignKeyName: "commemorative_date_colors_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "v_commemorative_dates_calendar" + referencedColumns: ["id"] + }, + { + foreignKeyName: "commemorative_date_colors_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "v_commemorative_dates_with_colors" + referencedColumns: ["id"] + }, + { + foreignKeyName: "commemorative_date_colors_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["commemorative_date_id"] + }, + { + foreignKeyName: "commemorative_date_colors_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["date_id"] + }, + { + foreignKeyName: "commemorative_date_colors_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["date_id"] + }, + { + foreignKeyName: "commemorative_date_colors_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["date_id"] + }, + ] } - ip_access_control: { + commemorative_date_exclusions: { Row: { - created_at: string - created_by: string - expires_at: string | null + commemorative_date_id: string + created_at: string | null + excluded_by: string | null id: string - ip_address: string - list_type: string - metadata: Json | null + product_id: string | null reason: string | null - updated_at: string + variant_id: string | null } Insert: { - created_at?: string - created_by: string - expires_at?: string | null + commemorative_date_id: string + created_at?: string | null + excluded_by?: string | null id?: string - ip_address: string - list_type: string - metadata?: Json | null + product_id?: string | null reason?: string | null - updated_at?: string + variant_id?: string | null } Update: { - created_at?: string - created_by?: string - expires_at?: string | null + commemorative_date_id?: string + created_at?: string | null + excluded_by?: string | null id?: string - ip_address?: string - list_type?: string - metadata?: Json | null + product_id?: string | null reason?: string | null - updated_at?: string - } - Relationships: [] - } - kit_collaborators: { - Row: { - created_at: string - id: string - invited_by: string | null - invited_email: string | null - kit_id: string - permission: string - updated_at: string - user_id: string - } - Insert: { - created_at?: string - id?: string - invited_by?: string | null - invited_email?: string | null - kit_id: string - permission?: string - updated_at?: string - user_id: string - } - Update: { - created_at?: string - id?: string - invited_by?: string | null - invited_email?: string | null - kit_id?: string - permission?: string - updated_at?: string - user_id?: string + variant_id?: string | null } Relationships: [ { - foreignKeyName: "kit_collaborators_kit_id_fkey" - columns: ["kit_id"] + foreignKeyName: "commemorative_date_exclusions_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] isOneToOne: false - referencedRelation: "custom_kits" + referencedRelation: "commemorative_dates" referencedColumns: ["id"] }, - ] - } - kit_comments: { - Row: { - author_id: string - body: string - created_at: string - id: string - item_anchor: string | null - kit_id: string - parent_id: string | null - resolved: boolean - updated_at: string - } - Insert: { - author_id: string - body: string - created_at?: string - id?: string - item_anchor?: string | null - kit_id: string - parent_id?: string | null - resolved?: boolean - updated_at?: string - } - Update: { - author_id?: string - body?: string - created_at?: string - id?: string - item_anchor?: string | null - kit_id?: string - parent_id?: string | null - resolved?: boolean - updated_at?: string - } - Relationships: [ { - foreignKeyName: "kit_comments_kit_id_fkey" - columns: ["kit_id"] + foreignKeyName: "commemorative_date_exclusions_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] isOneToOne: false - referencedRelation: "custom_kits" + referencedRelation: "v_commemorative_dates_calendar" referencedColumns: ["id"] }, { - foreignKeyName: "kit_comments_parent_id_fkey" - columns: ["parent_id"] + foreignKeyName: "commemorative_date_exclusions_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] isOneToOne: false - referencedRelation: "kit_comments" + referencedRelation: "v_commemorative_dates_with_colors" + referencedColumns: ["id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["commemorative_date_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["date_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["date_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["date_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "product_variants" referencedColumns: ["id"] }, + { + foreignKeyName: "commemorative_date_exclusions_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "commemorative_date_exclusions_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_variant_sale_prices" + referencedColumns: ["variant_id"] + }, ] } - kit_share_tokens: { + commemorative_dates: { Row: { - client_email: string | null - client_name: string | null - created_at: string - expires_at: string | null + banner_url: string | null + campaign_end_days: number | null + campaign_start_days: number | null + category: string | null + color_hex: string | null + created_at: string | null + created_by: string | null + date_day: number | null + date_month: number | null + description: string | null + display_order: number | null + icon_name: string | null id: string - kit_id: string - seller_id: string - status: string - token: string - updated_at: string - viewed_at: string | null + image_url: string | null + is_active: boolean | null + is_featured: boolean | null + is_fixed_date: boolean | null + name: string + organization_id: string | null + slug: string + target_audience: string | null + updated_at: string | null + updated_by: string | null + variable_date_rule: string | null } Insert: { - client_email?: string | null - client_name?: string | null - created_at?: string - expires_at?: string | null + banner_url?: string | null + campaign_end_days?: number | null + campaign_start_days?: number | null + category?: string | null + color_hex?: string | null + created_at?: string | null + created_by?: string | null + date_day?: number | null + date_month?: number | null + description?: string | null + display_order?: number | null + icon_name?: string | null id?: string - kit_id: string - seller_id: string - status?: string - token?: string - updated_at?: string - viewed_at?: string | null + image_url?: string | null + is_active?: boolean | null + is_featured?: boolean | null + is_fixed_date?: boolean | null + name: string + organization_id?: string | null + slug: string + target_audience?: string | null + updated_at?: string | null + updated_by?: string | null + variable_date_rule?: string | null } Update: { - client_email?: string | null - client_name?: string | null - created_at?: string - expires_at?: string | null + banner_url?: string | null + campaign_end_days?: number | null + campaign_start_days?: number | null + category?: string | null + color_hex?: string | null + created_at?: string | null + created_by?: string | null + date_day?: number | null + date_month?: number | null + description?: string | null + display_order?: number | null + icon_name?: string | null id?: string - kit_id?: string - seller_id?: string - status?: string - token?: string - updated_at?: string - viewed_at?: string | null + image_url?: string | null + is_active?: boolean | null + is_featured?: boolean | null + is_fixed_date?: boolean | null + name?: string + organization_id?: string | null + slug?: string + target_audience?: string | null + updated_at?: string | null + updated_by?: string | null + variable_date_rule?: string | null } Relationships: [ { - foreignKeyName: "kit_share_tokens_kit_id_fkey" - columns: ["kit_id"] + foreignKeyName: "commemorative_dates_organization_id_fkey" + columns: ["organization_id"] isOneToOne: false - referencedRelation: "custom_kits" + referencedRelation: "organizations" referencedColumns: ["id"] }, ] } - kit_templates: { + companies: { Row: { - box_data: Json | null - category: string - color: string - cover_image_url: string | null + brand_color: string | null + brand_logo_url: string | null created_at: string - created_by: string | null - description: string | null - icon: string id: string - is_active: boolean - items_data: Json - name: string - personalization_data: Json - tag: string | null - total_price: number + name: string | null updated_at: string - usage_count: number - volume_usage_percent: number } Insert: { - box_data?: Json | null - category?: string - color?: string - cover_image_url?: string | null + brand_color?: string | null + brand_logo_url?: string | null created_at?: string - created_by?: string | null - description?: string | null - icon?: string id?: string - is_active?: boolean - items_data?: Json - name: string - personalization_data?: Json - tag?: string | null - total_price?: number + name?: string | null updated_at?: string - usage_count?: number - volume_usage_percent?: number } Update: { - box_data?: Json | null - category?: string - color?: string - cover_image_url?: string | null + brand_color?: string | null + brand_logo_url?: string | null created_at?: string - created_by?: string | null - description?: string | null - icon?: string id?: string - is_active?: boolean - items_data?: Json - name?: string - personalization_data?: Json - tag?: string | null - total_price?: number + name?: string | null updated_at?: string - usage_count?: number - volume_usage_percent?: number } Relationships: [] } - kit_variants: { + company_email_patterns: { Row: { - box_data: Json | null - created_at: string + company_domain: string + company_name: string | null + created_at: string | null + email_provider: string | null id: string - items_data: Json - kit_master_id: string - kit_quantity: number - label: string - personalization_data: Json - sort_order: number - total_price: number - updated_at: string + is_catch_all: boolean | null + last_verified_at: string | null + mx_server: string | null + pattern_confidence: number | null + pattern_format: string + updated_at: string | null + verified_count: number | null } Insert: { - box_data?: Json | null - created_at?: string + company_domain: string + company_name?: string | null + created_at?: string | null + email_provider?: string | null id?: string - items_data?: Json - kit_master_id: string - kit_quantity?: number - label: string - personalization_data?: Json - sort_order?: number - total_price?: number - updated_at?: string + is_catch_all?: boolean | null + last_verified_at?: string | null + mx_server?: string | null + pattern_confidence?: number | null + pattern_format: string + updated_at?: string | null + verified_count?: number | null } Update: { - box_data?: Json | null - created_at?: string + company_domain?: string + company_name?: string | null + created_at?: string | null + email_provider?: string | null id?: string - items_data?: Json - kit_master_id?: string - kit_quantity?: number - label?: string - personalization_data?: Json - sort_order?: number - total_price?: number - updated_at?: string + is_catch_all?: boolean | null + last_verified_at?: string | null + mx_server?: string | null + pattern_confidence?: number | null + pattern_format?: string + updated_at?: string | null + verified_count?: number | null } - Relationships: [ - { - foreignKeyName: "kit_variants_kit_master_id_fkey" - columns: ["kit_master_id"] - isOneToOne: false - referencedRelation: "custom_kits" - referencedColumns: ["id"] - }, - ] + Relationships: [] } - login_attempts: { + comparison_reactions: { Row: { + anon_id: string + comparison_id: string created_at: string - email: string - failure_reason: string | null + emoji: string id: string - ip_address: string - metadata: Json | null - success: boolean + ip_hash: string | null + item_index: number user_agent: string | null - user_id: string | null } Insert: { + anon_id: string + comparison_id: string created_at?: string - email: string - failure_reason?: string | null + emoji: string id?: string - ip_address?: string - metadata?: Json | null - success?: boolean + ip_hash?: string | null + item_index?: number user_agent?: string | null - user_id?: string | null } Update: { + anon_id?: string + comparison_id?: string created_at?: string - email?: string - failure_reason?: string | null + emoji?: string id?: string - ip_address?: string - metadata?: Json | null - success?: boolean + ip_hash?: string | null + item_index?: number user_agent?: string | null - user_id?: string | null } Relationships: [] } - magic_up_brand_kits: { + component_media: { Row: { - client_id: string | null - client_name: string | null + component_id: string created_at: string - forbidden_words: string[] id: string - logo_urls: Json - metadata: Json - notes: string | null - primary_color: string | null - required_words: string[] - secondary_color: string | null - tone_of_voice: string | null + is_cover: boolean | null + media_type: string + product_id: string + sort_order: number | null + title: string | null updated_at: string - user_id: string - visual_style: string | null + url: string } Insert: { - client_id?: string | null - client_name?: string | null + component_id: string created_at?: string - forbidden_words?: string[] id?: string - logo_urls?: Json - metadata?: Json - notes?: string | null - primary_color?: string | null - required_words?: string[] - secondary_color?: string | null - tone_of_voice?: string | null + is_cover?: boolean | null + media_type?: string + product_id: string + sort_order?: number | null + title?: string | null updated_at?: string - user_id: string - visual_style?: string | null + url: string } Update: { - client_id?: string | null - client_name?: string | null + component_id?: string created_at?: string - forbidden_words?: string[] id?: string - logo_urls?: Json - metadata?: Json - notes?: string | null - primary_color?: string | null - required_words?: string[] - secondary_color?: string | null - tone_of_voice?: string | null + is_cover?: boolean | null + media_type?: string + product_id?: string + sort_order?: number | null + title?: string | null updated_at?: string - user_id?: string - visual_style?: string | null + url?: string } Relationships: [] } - magic_up_campaigns: { + connection_test_history: { Row: { - audience: string | null - channel: string | null - client_id: string | null - client_name: string | null + attempts: number + connection_id: string created_at: string - cta: string | null + dns_ms: number | null + download_ms: number | null + error_kind: string | null + error_message: string | null id: string - metadata: Json - objective: string | null - occasion: string | null - status: string - title: string - tone: string | null - updated_at: string - user_id: string + latency_ms: number | null + request_method: string | null + request_url: string | null + response_body: string | null + response_headers: Json | null + status_code: number | null + success: boolean + tcp_ms: number | null + tested_at: string + tls_ms: number | null + triggered_by: string + triggered_by_user_id: string | null + ttfb_ms: number | null } Insert: { - audience?: string | null - channel?: string | null - client_id?: string | null - client_name?: string | null + attempts?: number + connection_id: string created_at?: string - cta?: string | null + dns_ms?: number | null + download_ms?: number | null + error_kind?: string | null + error_message?: string | null id?: string - metadata?: Json - objective?: string | null - occasion?: string | null - status?: string - title?: string - tone?: string | null - updated_at?: string - user_id: string + latency_ms?: number | null + request_method?: string | null + request_url?: string | null + response_body?: string | null + response_headers?: Json | null + status_code?: number | null + success?: boolean + tcp_ms?: number | null + tested_at?: string + tls_ms?: number | null + triggered_by?: string + triggered_by_user_id?: string | null + ttfb_ms?: number | null } Update: { - audience?: string | null - channel?: string | null - client_id?: string | null - client_name?: string | null + attempts?: number + connection_id?: string created_at?: string - cta?: string | null + dns_ms?: number | null + download_ms?: number | null + error_kind?: string | null + error_message?: string | null id?: string - metadata?: Json - objective?: string | null - occasion?: string | null - status?: string - title?: string - tone?: string | null - updated_at?: string - user_id?: string - } - Relationships: [] - } - magic_up_comments: { - Row: { - author_name: string - comment: string - created_at: string - generation_id: string - id: string - is_public: boolean - user_id: string - } - Insert: { - author_name?: string - comment: string - created_at?: string - generation_id: string - id?: string - is_public?: boolean - user_id: string - } - Update: { - author_name?: string - comment?: string - created_at?: string - generation_id?: string - id?: string - is_public?: boolean - user_id?: string + latency_ms?: number | null + request_method?: string | null + request_url?: string | null + response_body?: string | null + response_headers?: Json | null + status_code?: number | null + success?: boolean + tcp_ms?: number | null + tested_at?: string + tls_ms?: number | null + triggered_by?: string + triggered_by_user_id?: string | null + ttfb_ms?: number | null } Relationships: [ { - foreignKeyName: "magic_up_comments_generation_id_fkey" - columns: ["generation_id"] + foreignKeyName: "connection_test_history_connection_id_fkey" + columns: ["connection_id"] isOneToOne: false - referencedRelation: "magic_up_generations" + referencedRelation: "external_connections" referencedColumns: ["id"] }, ] } - magic_up_generations: { + conversation_audit_logs: { Row: { - aspect_ratio: string | null - campaign_id: string | null - channel: string | null - client_name: string | null - copy_pack: Json - created_at: string - export_presets: Json - generated_image_url: string | null + client_info: Json | null + ended_at: string | null id: string - is_favorite: boolean | null - metadata: Json - model: string | null - product_id: string | null - product_name: string | null - product_sku: string | null - prompt_text: string | null - quality_score: number | null - scene_category: string | null - scene_title: string | null + metadata: Json | null + session_id: string + started_at: string status: string - tags: string[] + total_tokens_estimated: number | null user_id: string } Insert: { - aspect_ratio?: string | null - campaign_id?: string | null - channel?: string | null - client_name?: string | null - copy_pack?: Json - created_at?: string - export_presets?: Json - generated_image_url?: string | null + client_info?: Json | null + ended_at?: string | null id?: string - is_favorite?: boolean | null - metadata?: Json - model?: string | null - product_id?: string | null - product_name?: string | null - product_sku?: string | null - prompt_text?: string | null - quality_score?: number | null - scene_category?: string | null - scene_title?: string | null + metadata?: Json | null + session_id: string + started_at?: string status?: string - tags?: string[] + total_tokens_estimated?: number | null user_id: string } Update: { - aspect_ratio?: string | null - campaign_id?: string | null - channel?: string | null - client_name?: string | null - copy_pack?: Json - created_at?: string - export_presets?: Json - generated_image_url?: string | null + client_info?: Json | null + ended_at?: string | null id?: string - is_favorite?: boolean | null - metadata?: Json - model?: string | null - product_id?: string | null - product_name?: string | null - product_sku?: string | null - prompt_text?: string | null - quality_score?: number | null - scene_category?: string | null - scene_title?: string | null + metadata?: Json | null + session_id?: string + started_at?: string status?: string - tags?: string[] + total_tokens_estimated?: number | null user_id?: string } - Relationships: [ - { - foreignKeyName: "magic_up_generations_campaign_id_fkey" - columns: ["campaign_id"] - isOneToOne: false - referencedRelation: "magic_up_campaigns" - referencedColumns: ["id"] - }, - ] + Relationships: [] } - magic_up_public_shares: { + conversation_delivery_status: { Row: { - allow_comments: boolean - allow_download: boolean - campaign_id: string | null - created_at: string - expires_at: string | null - generation_id: string | null + error_details: string | null + event_id: string id: string - metadata: Json - share_token: string status: string updated_at: string - user_id: string } Insert: { - allow_comments?: boolean - allow_download?: boolean - campaign_id?: string | null - created_at?: string - expires_at?: string | null - generation_id?: string | null + error_details?: string | null + event_id: string id?: string - metadata?: Json - share_token?: string status?: string updated_at?: string - user_id: string } Update: { - allow_comments?: boolean - allow_download?: boolean - campaign_id?: string | null - created_at?: string - expires_at?: string | null - generation_id?: string | null + error_details?: string | null + event_id?: string id?: string - metadata?: Json - share_token?: string status?: string updated_at?: string - user_id?: string } - Relationships: [ - { - foreignKeyName: "magic_up_public_shares_campaign_id_fkey" - columns: ["campaign_id"] - isOneToOne: false - referencedRelation: "magic_up_campaigns" - referencedColumns: ["id"] - }, - { - foreignKeyName: "magic_up_public_shares_generation_id_fkey" - columns: ["generation_id"] - isOneToOne: false - referencedRelation: "magic_up_generations" - referencedColumns: ["id"] - }, - ] + Relationships: [] } - magic_up_reactions: { + conversation_event_history: { Row: { + content: string | null + conversation_id: string created_at: string - generation_id: string + event_type: Database["public"]["Enums"]["conversation_event_type"] id: string - ip_hash: string | null - reaction_type: string - user_agent: string | null - user_id: string + media_metadata: Json | null + media_url: string | null + request_id: string | null + role: string + tokens_estimated: number | null } Insert: { + content?: string | null + conversation_id: string created_at?: string - generation_id: string + event_type?: Database["public"]["Enums"]["conversation_event_type"] id?: string - ip_hash?: string | null - reaction_type: string - user_agent?: string | null - user_id: string + media_metadata?: Json | null + media_url?: string | null + request_id?: string | null + role: string + tokens_estimated?: number | null } Update: { + content?: string | null + conversation_id?: string created_at?: string - generation_id?: string + event_type?: Database["public"]["Enums"]["conversation_event_type"] id?: string - ip_hash?: string | null - reaction_type?: string - user_agent?: string | null - user_id?: string + media_metadata?: Json | null + media_url?: string | null + request_id?: string | null + role?: string + tokens_estimated?: number | null } - Relationships: [ - { - foreignKeyName: "magic_up_reactions_generation_id_fkey" - columns: ["generation_id"] - isOneToOne: false - referencedRelation: "magic_up_generations" - referencedColumns: ["id"] - }, - ] + Relationships: [] } - mcp_access_violations: { + custom_kits: { Row: { - created_at: string - details: Json + box_data: Json | null + box_price: number | null + color: string | null + created_at: string | null + description: string | null + icon: string | null id: string - ip_address: string | null - operation: string | null - reason: string - request_id: string | null - source: string - target_key_id: string | null - user_agent: string | null + is_favorite: boolean + is_pinned: boolean + items_data: Json | null + items_price: number | null + kit_quantity: number | null + kit_type: string | null + last_used_at: string | null + name: string | null + organization_id: string + personalization_data: Json | null + personalization_price: number | null + status: string | null + tag: string | null + total_price: number | null + updated_at: string | null user_id: string | null + volume_usage_percent: number | null } Insert: { - created_at?: string - details?: Json + box_data?: Json | null + box_price?: number | null + color?: string | null + created_at?: string | null + description?: string | null + icon?: string | null id?: string - ip_address?: string | null - operation?: string | null - reason: string - request_id?: string | null - source: string - target_key_id?: string | null - user_agent?: string | null - user_id?: string | null - } + is_favorite?: boolean + is_pinned?: boolean + items_data?: Json | null + items_price?: number | null + kit_quantity?: number | null + kit_type?: string | null + last_used_at?: string | null + name?: string | null + organization_id?: string + personalization_data?: Json | null + personalization_price?: number | null + status?: string | null + tag?: string | null + total_price?: number | null + updated_at?: string | null + user_id?: string | null + volume_usage_percent?: number | null + } Update: { - created_at?: string - details?: Json + box_data?: Json | null + box_price?: number | null + color?: string | null + created_at?: string | null + description?: string | null + icon?: string | null id?: string - ip_address?: string | null - operation?: string | null - reason?: string - request_id?: string | null - source?: string - target_key_id?: string | null - user_agent?: string | null + is_favorite?: boolean + is_pinned?: boolean + items_data?: Json | null + items_price?: number | null + kit_quantity?: number | null + kit_type?: string | null + last_used_at?: string | null + name?: string | null + organization_id?: string + personalization_data?: Json | null + personalization_price?: number | null + status?: string | null + tag?: string | null + total_price?: number | null + updated_at?: string | null user_id?: string | null + volume_usage_percent?: number | null } Relationships: [] } - mcp_api_keys: { + discount_approval_requests: { Row: { + admin_id: string | null + admin_notes: string | null created_at: string - created_by: string - description: string | null - expires_at: string | null id: string - key_hash: string - key_prefix: string - last_used_at: string | null - name: string - revoked_at: string | null - rotated_from: string | null - scopes: string[] + max_allowed_percent: number + quote_id: string + quote_snapshot_hash: string | null + requested_discount_percent: number + responded_at: string | null + seller_id: string + seller_notes: string | null + status: string updated_at: string + valid_until: string | null } Insert: { + admin_id?: string | null + admin_notes?: string | null created_at?: string - created_by: string - description?: string | null - expires_at?: string | null id?: string - key_hash: string - key_prefix: string - last_used_at?: string | null - name: string - revoked_at?: string | null - rotated_from?: string | null - scopes?: string[] + max_allowed_percent: number + quote_id: string + quote_snapshot_hash?: string | null + requested_discount_percent: number + responded_at?: string | null + seller_id: string + seller_notes?: string | null + status?: string updated_at?: string + valid_until?: string | null } Update: { + admin_id?: string | null + admin_notes?: string | null created_at?: string - created_by?: string - description?: string | null - expires_at?: string | null id?: string - key_hash?: string - key_prefix?: string - last_used_at?: string | null - name?: string - revoked_at?: string | null - rotated_from?: string | null - scopes?: string[] + max_allowed_percent?: number + quote_id?: string + quote_snapshot_hash?: string | null + requested_discount_percent?: number + responded_at?: string | null + seller_id?: string + seller_notes?: string | null + status?: string updated_at?: string + valid_until?: string | null } Relationships: [ { - foreignKeyName: "mcp_api_keys_rotated_from_fkey" - columns: ["rotated_from"] + foreignKeyName: "discount_approval_requests_quote_id_fkey" + columns: ["quote_id"] isOneToOne: false - referencedRelation: "mcp_api_keys" + referencedRelation: "quotes" referencedColumns: ["id"] }, ] } - mcp_full_grantors: { + e2e_cleanup_rate_limit: { Row: { - granted_at: string - granted_by: string | null - reason: string | null - user_id: string + count: number + key: string + updated_at: string + window_start: string } Insert: { - granted_at?: string - granted_by?: string | null - reason?: string | null - user_id: string + count?: number + key: string + updated_at?: string + window_start?: string } Update: { - granted_at?: string - granted_by?: string | null - reason?: string | null - user_id?: string + count?: number + key?: string + updated_at?: string + window_start?: string } Relationships: [] } - mcp_key_auto_revocations: { + eco_material_config: { Row: { - created_at: string - created_by: string - id: string - key_id: string - reason: string - revoked_at: string - source: string + created_at: string | null + is_active: boolean | null + material_id: string + material_name: string + notes: string | null } Insert: { - created_at?: string - created_by: string - id?: string - key_id: string - reason?: string - revoked_at?: string - source: string + created_at?: string | null + is_active?: boolean | null + material_id: string + material_name: string + notes?: string | null } Update: { - created_at?: string - created_by?: string - id?: string - key_id?: string - reason?: string - revoked_at?: string - source?: string + created_at?: string | null + is_active?: boolean | null + material_id?: string + material_name?: string + notes?: string | null } Relationships: [ { - foreignKeyName: "mcp_key_auto_revocations_key_id_fkey" - columns: ["key_id"] - isOneToOne: false - referencedRelation: "mcp_api_keys" + foreignKeyName: "eco_material_config_material_id_fkey" + columns: ["material_id"] + isOneToOne: true + referencedRelation: "material_types" referencedColumns: ["id"] }, + { + foreignKeyName: "eco_material_config_material_id_fkey" + columns: ["material_id"] + isOneToOne: true + referencedRelation: "materials_complete" + referencedColumns: ["material_id"] + }, + { + foreignKeyName: "eco_material_config_material_id_fkey" + columns: ["material_id"] + isOneToOne: true + referencedRelation: "products_with_materials" + referencedColumns: ["material_id"] + }, ] } - mockup_drafts: { + edge_function_invocations: { Row: { - client_id: string | null - client_name: string | null - created_at: string - draft_key: string + duration_ms: number | null + error_message: string | null + function_slug: string id: string - logo_data: string | null - personalization_areas: Json | null - product_id: string | null - product_name: string | null - technique_id: string | null - technique_name: string | null - updated_at: string - user_id: string + invoked_at: string + invoked_by: string | null + ip_address: unknown + request_metadata: Json | null + request_method: string | null + status_code: number | null + user_agent: string | null } Insert: { - client_id?: string | null - client_name?: string | null - created_at?: string - draft_key?: string + duration_ms?: number | null + error_message?: string | null + function_slug: string id?: string - logo_data?: string | null - personalization_areas?: Json | null - product_id?: string | null - product_name?: string | null - technique_id?: string | null - technique_name?: string | null - updated_at?: string - user_id: string + invoked_at?: string + invoked_by?: string | null + ip_address?: unknown + request_metadata?: Json | null + request_method?: string | null + status_code?: number | null + user_agent?: string | null } Update: { - client_id?: string | null - client_name?: string | null - created_at?: string - draft_key?: string + duration_ms?: number | null + error_message?: string | null + function_slug?: string id?: string - logo_data?: string | null - personalization_areas?: Json | null - product_id?: string | null - product_name?: string | null - technique_id?: string | null - technique_name?: string | null - updated_at?: string - user_id?: string + invoked_at?: string + invoked_by?: string | null + ip_address?: unknown + request_metadata?: Json | null + request_method?: string | null + status_code?: number | null + user_agent?: string | null } Relationships: [] } - mockup_prompt_configs: { + edge_rate_limits: { Row: { - ai_model: string - config_key: string - created_at: string - id: string - is_active: boolean - label: string - prompt_text: string - technique_id: string | null - updated_at: string - version: number + count: number + created_at: string | null + key: string + reset_at: string + updated_at: string | null } Insert: { - ai_model?: string - config_key: string - created_at?: string - id?: string - is_active?: boolean - label: string - prompt_text: string - technique_id?: string | null - updated_at?: string - version?: number + count?: number + created_at?: string | null + key: string + reset_at: string + updated_at?: string | null } Update: { - ai_model?: string - config_key?: string - created_at?: string - id?: string - is_active?: boolean - label?: string - prompt_text?: string - technique_id?: string | null - updated_at?: string - version?: number + count?: number + created_at?: string | null + key?: string + reset_at?: string + updated_at?: string | null } Relationships: [] } - mockup_prompt_history: { + enriched_contacts: { Row: { - ai_model: string - change_notes: string | null - changed_at: string - changed_by: string | null - config_id: string - config_key: string + bitrix24_contact_id: number | null + bitrix24_synced_at: string | null + company_domain: string | null + company_industry: string | null + company_linkedin_url: string | null + company_size: string | null + company_website: string | null + created_at: string | null + created_by: string | null + current_company: string | null + current_title: string | null + enrichment_attempts: number | null + enrichment_status: string | null + first_name: string + full_name: string | null + headline: string | null id: string - new_prompt: string - old_prompt: string | null - version: number + last_enriched_at: string | null + last_name: string + linkedin_profile_id: string | null + linkedin_url: string | null + location: string | null + personal_email: string | null + personal_email_confidence: number | null + personal_email_source: string | null + phone_mobile: string | null + phone_mobile_confidence: number | null + phone_mobile_source: string | null + phone_work: string | null + phone_work_confidence: number | null + phone_work_source: string | null + profile_picture_url: string | null + updated_at: string | null + whatsapp_number: string | null + work_email: string | null + work_email_confidence: number | null + work_email_source: string | null + work_email_verified_at: string | null } Insert: { - ai_model: string - change_notes?: string | null - changed_at?: string - changed_by?: string | null - config_id: string - config_key: string + bitrix24_contact_id?: number | null + bitrix24_synced_at?: string | null + company_domain?: string | null + company_industry?: string | null + company_linkedin_url?: string | null + company_size?: string | null + company_website?: string | null + created_at?: string | null + created_by?: string | null + current_company?: string | null + current_title?: string | null + enrichment_attempts?: number | null + enrichment_status?: string | null + first_name: string + full_name?: string | null + headline?: string | null + id?: string + last_enriched_at?: string | null + last_name: string + linkedin_profile_id?: string | null + linkedin_url?: string | null + location?: string | null + personal_email?: string | null + personal_email_confidence?: number | null + personal_email_source?: string | null + phone_mobile?: string | null + phone_mobile_confidence?: number | null + phone_mobile_source?: string | null + phone_work?: string | null + phone_work_confidence?: number | null + phone_work_source?: string | null + profile_picture_url?: string | null + updated_at?: string | null + whatsapp_number?: string | null + work_email?: string | null + work_email_confidence?: number | null + work_email_source?: string | null + work_email_verified_at?: string | null + } + Update: { + bitrix24_contact_id?: number | null + bitrix24_synced_at?: string | null + company_domain?: string | null + company_industry?: string | null + company_linkedin_url?: string | null + company_size?: string | null + company_website?: string | null + created_at?: string | null + created_by?: string | null + current_company?: string | null + current_title?: string | null + enrichment_attempts?: number | null + enrichment_status?: string | null + first_name?: string + full_name?: string | null + headline?: string | null + id?: string + last_enriched_at?: string | null + last_name?: string + linkedin_profile_id?: string | null + linkedin_url?: string | null + location?: string | null + personal_email?: string | null + personal_email_confidence?: number | null + personal_email_source?: string | null + phone_mobile?: string | null + phone_mobile_confidence?: number | null + phone_mobile_source?: string | null + phone_work?: string | null + phone_work_confidence?: number | null + phone_work_source?: string | null + profile_picture_url?: string | null + updated_at?: string | null + whatsapp_number?: string | null + work_email?: string | null + work_email_confidence?: number | null + work_email_source?: string | null + work_email_verified_at?: string | null + } + Relationships: [] + } + enrichment_log: { + Row: { + contact_id: string | null + cost_usd: number | null + created_at: string | null + credits_used: number | null + data_found: Json | null + enrichment_level: number | null + error_message: string | null + id: string + provider_name: string | null + response_time_ms: number | null + success: boolean | null + } + Insert: { + contact_id?: string | null + cost_usd?: number | null + created_at?: string | null + credits_used?: number | null + data_found?: Json | null + enrichment_level?: number | null + error_message?: string | null id?: string - new_prompt: string - old_prompt?: string | null - version: number + provider_name?: string | null + response_time_ms?: number | null + success?: boolean | null } Update: { - ai_model?: string - change_notes?: string | null - changed_at?: string - changed_by?: string | null - config_id?: string - config_key?: string + contact_id?: string | null + cost_usd?: number | null + created_at?: string | null + credits_used?: number | null + data_found?: Json | null + enrichment_level?: number | null + error_message?: string | null id?: string - new_prompt?: string - old_prompt?: string | null - version?: number + provider_name?: string | null + response_time_ms?: number | null + success?: boolean | null } Relationships: [ { - foreignKeyName: "mockup_prompt_history_config_id_fkey" - columns: ["config_id"] + foreignKeyName: "enrichment_log_contact_id_fkey" + columns: ["contact_id"] isOneToOne: false - referencedRelation: "mockup_prompt_configs" + referencedRelation: "enriched_contacts" + referencedColumns: ["id"] + }, + { + foreignKeyName: "enrichment_log_contact_id_fkey" + columns: ["contact_id"] + isOneToOne: false + referencedRelation: "v_needs_enrichment" referencedColumns: ["id"] }, ] } - mockup_templates: { + expert_conversations: { Row: { - available_colors: Json | null + client_id: string | null created_at: string - default_technique_id: string | null - description: string | null id: string - is_active: boolean | null - is_featured: boolean | null - name: string - predefined_areas: Json - product_id: string | null - template_image_url: string + seller_id: string + title: string updated_at: string - usage_count: number | null } Insert: { - available_colors?: Json | null + client_id?: string | null created_at?: string - default_technique_id?: string | null - description?: string | null id?: string - is_active?: boolean | null - is_featured?: boolean | null - name: string - predefined_areas?: Json - product_id?: string | null - template_image_url: string + seller_id: string + title?: string updated_at?: string - usage_count?: number | null } Update: { - available_colors?: Json | null + client_id?: string | null created_at?: string - default_technique_id?: string | null - description?: string | null id?: string - is_active?: boolean | null - is_featured?: boolean | null - name?: string - predefined_areas?: Json - product_id?: string | null - template_image_url?: string + seller_id?: string + title?: string updated_at?: string - usage_count?: number | null } Relationships: [] } - optimization_queue: { + expert_messages: { Row: { - category: string + content: string + conversation_id: string created_at: string - created_by: string | null - description: string | null - error: string | null - finished_at: string | null - guardrail_status: string | null id: string - priority: number - result: Json | null - started_at: string | null + role: string + } + Insert: { + content: string + conversation_id: string + created_at?: string + id?: string + role?: string + } + Update: { + content?: string + conversation_id?: string + created_at?: string + id?: string + role?: string + } + Relationships: [] + } + external_connections: { + Row: { + auto_test_enabled: boolean + config: Json + created_at: string + created_by: string + env_key: string | null + id: string + last_latency_ms: number | null + last_test_at: string | null + last_test_message: string | null + last_test_ok: boolean | null + name: string + secret_refs: string[] status: string - title: string + type: string updated_at: string } Insert: { - category?: string + auto_test_enabled?: boolean + config?: Json created_at?: string - created_by?: string | null - description?: string | null - error?: string | null - finished_at?: string | null - guardrail_status?: string | null + created_by: string + env_key?: string | null id?: string - priority?: number - result?: Json | null - started_at?: string | null + last_latency_ms?: number | null + last_test_at?: string | null + last_test_message?: string | null + last_test_ok?: boolean | null + name: string + secret_refs?: string[] status?: string - title: string + type: string updated_at?: string } Update: { - category?: string + auto_test_enabled?: boolean + config?: Json created_at?: string - created_by?: string | null - description?: string | null - error?: string | null - finished_at?: string | null - guardrail_status?: string | null + created_by?: string + env_key?: string | null id?: string - priority?: number - result?: Json | null - started_at?: string | null + last_latency_ms?: number | null + last_test_at?: string | null + last_test_message?: string | null + last_test_ok?: boolean | null + name?: string + secret_refs?: string[] status?: string - title?: string + type?: string updated_at?: string } Relationships: [] } - optimization_queue_runs: { + external_connections_sync_log: { Row: { - created_at: string + completed_at: string | null + connection_id: string | null + connection_name: string duration_ms: number | null - executed_by: string | null - guardrail_status: string | null + error_message: string | null id: string - notes: string | null - queue_id: string + metadata: Json | null + records_failed: number | null + records_processed: number | null + started_at: string status: string + sync_type: string } Insert: { - created_at?: string + completed_at?: string | null + connection_id?: string | null + connection_name: string duration_ms?: number | null - executed_by?: string | null - guardrail_status?: string | null + error_message?: string | null id?: string - notes?: string | null - queue_id: string - status: string + metadata?: Json | null + records_failed?: number | null + records_processed?: number | null + started_at?: string + status?: string + sync_type?: string } Update: { - created_at?: string + completed_at?: string | null + connection_id?: string | null + connection_name?: string duration_ms?: number | null - executed_by?: string | null - guardrail_status?: string | null + error_message?: string | null id?: string - notes?: string | null - queue_id?: string + metadata?: Json | null + records_failed?: number | null + records_processed?: number | null + started_at?: string status?: string - } - Relationships: [ - { - foreignKeyName: "optimization_queue_runs_queue_id_fkey" - columns: ["queue_id"] - isOneToOne: false - referencedRelation: "optimization_queue" - referencedColumns: ["id"] - }, - ] - } - order_item_personalizations: { - Row: { - created_at: string | null - id: string - image_url: string | null - location_id: string | null - location_name: string | null - order_item_id: string - personalization_text: string | null - price_adjustment: number | null - technique_id: string | null - technique_name: string | null - updated_at: string | null - } - Insert: { - created_at?: string | null - id?: string - image_url?: string | null - location_id?: string | null - location_name?: string | null - order_item_id: string - personalization_text?: string | null - price_adjustment?: number | null - technique_id?: string | null - technique_name?: string | null - updated_at?: string | null - } - Update: { - created_at?: string | null - id?: string - image_url?: string | null - location_id?: string | null - location_name?: string | null - order_item_id?: string - personalization_text?: string | null - price_adjustment?: number | null - technique_id?: string | null - technique_name?: string | null - updated_at?: string | null - } - Relationships: [ - { - foreignKeyName: "order_item_personalizations_order_item_id_fkey" - columns: ["order_item_id"] - isOneToOne: false - referencedRelation: "order_items" - referencedColumns: ["id"] - }, - ] - } - order_items: { - Row: { - created_at: string - discount_amount: number | null - id: string - order_id: string | null - personalization_config: Json | null - personalization_cost: number | null - product_description: string | null - product_id: string | null - product_image_url: string | null - product_name: string | null - product_sku: string | null - production_notes: string | null - production_status: string | null - quantity: number | null - quote_item_id: string | null - subtotal: number - unit_price: number | null - updated_at: string | null - } - Insert: { - created_at?: string - discount_amount?: number | null - id?: string - order_id?: string | null - personalization_config?: Json | null - personalization_cost?: number | null - product_description?: string | null - product_id?: string | null - product_image_url?: string | null - product_name?: string | null - product_sku?: string | null - production_notes?: string | null - production_status?: string | null - quantity?: number | null - quote_item_id?: string | null - subtotal?: number - unit_price?: number | null - updated_at?: string | null - } - Update: { - created_at?: string - discount_amount?: number | null - id?: string - order_id?: string | null - personalization_config?: Json | null - personalization_cost?: number | null - product_description?: string | null - product_id?: string | null - product_image_url?: string | null - product_name?: string | null - product_sku?: string | null - production_notes?: string | null - production_status?: string | null - quantity?: number | null - quote_item_id?: string | null - subtotal?: number - unit_price?: number | null - updated_at?: string | null + sync_type?: string } Relationships: [] } - orders: { + favorite_item_reactions: { Row: { - assigned_to: string | null - client_company: string | null - client_email: string | null - client_id: string | null - client_name: string | null - client_phone: string | null + anon_id: string created_at: string - created_by: string | null - delivered_at: string | null - delivery_address: string | null - delivery_time: string | null - discount_amount: number | null - estimated_delivery_date: string | null - fulfillment_status: string + emoji: string id: string - internal_notes: string | null - notes: string | null - order_number: string - organization_id: string | null - paid_amount: number | null - payment_due_date: string | null - payment_method: string | null - payment_status: string | null - payment_terms: string | null - quote_id: string | null - seller_id: string - shipping_address: Json | null - shipping_cost: number | null - shipping_method: string | null - shipping_type: string | null - status: string - subtotal: number | null - tax_amount: number | null - total: number | null - tracking_number: string | null - updated_at: string - version: number + ip_hash: string | null + item_id: string + list_id: string + user_agent: string | null } Insert: { - assigned_to?: string | null - client_company?: string | null - client_email?: string | null - client_id?: string | null - client_name?: string | null - client_phone?: string | null + anon_id: string created_at?: string - created_by?: string | null - delivered_at?: string | null - delivery_address?: string | null - delivery_time?: string | null - discount_amount?: number | null - estimated_delivery_date?: string | null - fulfillment_status?: string + emoji: string id?: string - internal_notes?: string | null - notes?: string | null - order_number?: string - organization_id?: string | null - paid_amount?: number | null - payment_due_date?: string | null - payment_method?: string | null - payment_status?: string | null - payment_terms?: string | null - quote_id?: string | null - seller_id: string - shipping_address?: Json | null - shipping_cost?: number | null - shipping_method?: string | null - shipping_type?: string | null - status?: string - subtotal?: number | null - tax_amount?: number | null - total?: number | null - tracking_number?: string | null - updated_at?: string - version?: number + ip_hash?: string | null + item_id: string + list_id: string + user_agent?: string | null } Update: { - assigned_to?: string | null - client_company?: string | null - client_email?: string | null - client_id?: string | null - client_name?: string | null - client_phone?: string | null + anon_id?: string created_at?: string - created_by?: string | null - delivered_at?: string | null - delivery_address?: string | null - delivery_time?: string | null - discount_amount?: number | null - estimated_delivery_date?: string | null - fulfillment_status?: string + emoji?: string id?: string - internal_notes?: string | null - notes?: string | null - order_number?: string - organization_id?: string | null - paid_amount?: number | null - payment_due_date?: string | null - payment_method?: string | null - payment_status?: string | null - payment_terms?: string | null - quote_id?: string | null - seller_id?: string - shipping_address?: Json | null - shipping_cost?: number | null - shipping_method?: string | null - shipping_type?: string | null - status?: string - subtotal?: number | null - tax_amount?: number | null - total?: number | null - tracking_number?: string | null - updated_at?: string - version?: number + ip_hash?: string | null + item_id?: string + list_id?: string + user_agent?: string | null } Relationships: [ { - foreignKeyName: "orders_organization_id_fkey" - columns: ["organization_id"] + foreignKeyName: "favorite_item_reactions_item_id_fkey" + columns: ["item_id"] isOneToOne: false - referencedRelation: "organizations" + referencedRelation: "favorite_items" referencedColumns: ["id"] }, { - foreignKeyName: "orders_quote_id_fkey" - columns: ["quote_id"] + foreignKeyName: "favorite_item_reactions_list_id_fkey" + columns: ["list_id"] isOneToOne: false - referencedRelation: "quotes" + referencedRelation: "favorite_lists" referencedColumns: ["id"] }, ] } - organization_members: { + favorite_items: { Row: { - created_at: string + added_at: string id: string - invited_by: string | null - joined_at: string - organization_id: string - role: Database["public"]["Enums"]["org_role"] - updated_at: string + list_id: string + note: string | null + position: number + price_at_save: number | null + product_id: string + updated_at: string user_id: string + variant_id: string | null + variant_info: Json | null } Insert: { - created_at?: string + added_at?: string id?: string - invited_by?: string | null - joined_at?: string - organization_id: string - role?: Database["public"]["Enums"]["org_role"] + list_id: string + note?: string | null + position?: number + price_at_save?: number | null + product_id: string updated_at?: string user_id: string + variant_id?: string | null + variant_info?: Json | null } Update: { - created_at?: string + added_at?: string id?: string - invited_by?: string | null - joined_at?: string - organization_id?: string - role?: Database["public"]["Enums"]["org_role"] + list_id?: string + note?: string | null + position?: number + price_at_save?: number | null + product_id?: string updated_at?: string user_id?: string + variant_id?: string | null + variant_info?: Json | null } Relationships: [ { - foreignKeyName: "organization_members_organization_id_fkey" - columns: ["organization_id"] + foreignKeyName: "favorite_items_list_id_fkey" + columns: ["list_id"] isOneToOne: false - referencedRelation: "organizations" + referencedRelation: "favorite_lists" + referencedColumns: ["id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "favorite_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" referencedColumns: ["id"] }, ] } - organizations: { + favorite_items_trash: { Row: { - created_at: string - description: string | null + added_at: string | null + deleted_at: string + expires_at: string | null id: string - is_active: boolean - logo_url: string | null - name: string - settings: Json | null - slug: string - updated_at: string + list_id: string + note: string | null + original_id: string | null + position: number | null + price_at_save: number | null + product_id: string + user_id: string + variant_id: string | null + variant_info: Json | null } Insert: { - created_at?: string - description?: string | null + added_at?: string | null + deleted_at?: string + expires_at?: string | null id?: string - is_active?: boolean - logo_url?: string | null - name: string - settings?: Json | null - slug: string - updated_at?: string + list_id: string + note?: string | null + original_id?: string | null + position?: number | null + price_at_save?: number | null + product_id: string + user_id: string + variant_id?: string | null + variant_info?: Json | null } Update: { - created_at?: string - description?: string | null + added_at?: string | null + deleted_at?: string + expires_at?: string | null id?: string - is_active?: boolean - logo_url?: string | null - name?: string - settings?: Json | null - slug?: string - updated_at?: string + list_id?: string + note?: string | null + original_id?: string | null + position?: number | null + price_at_save?: number | null + product_id?: string + user_id?: string + variant_id?: string | null + variant_info?: Json | null } Relationships: [] } - outbound_webhooks: { + favorite_lists: { Row: { - active: boolean - auto_disabled_at: string | null - auto_disabled_reason: string | null - consecutive_failures: number + client_id: string | null + client_name: string | null + color: string created_at: string - created_by: string description: string | null - events: string[] + icon: string id: string - last_triggered_at: string | null + is_archived: boolean + is_default: boolean name: string - retry_policy: Json - secret_ref: string | null - total_failure: number - total_success: number + position: number + shared_expires_at: string | null + shared_token: string | null updated_at: string - url: string + user_id: string } Insert: { - active?: boolean - auto_disabled_at?: string | null - auto_disabled_reason?: string | null - consecutive_failures?: number + client_id?: string | null + client_name?: string | null + color?: string created_at?: string - created_by: string description?: string | null - events?: string[] + icon?: string id?: string - last_triggered_at?: string | null + is_archived?: boolean + is_default?: boolean name: string - retry_policy?: Json - secret_ref?: string | null - total_failure?: number - total_success?: number + position?: number + shared_expires_at?: string | null + shared_token?: string | null updated_at?: string - url: string + user_id: string } Update: { - active?: boolean - auto_disabled_at?: string | null - auto_disabled_reason?: string | null - consecutive_failures?: number + client_id?: string | null + client_name?: string | null + color?: string created_at?: string - created_by?: string description?: string | null - events?: string[] + icon?: string id?: string - last_triggered_at?: string | null + is_archived?: boolean + is_default?: boolean name?: string - retry_policy?: Json - secret_ref?: string | null - total_failure?: number - total_success?: number + position?: number + shared_expires_at?: string | null + shared_token?: string | null updated_at?: string - url?: string - } - Relationships: [] - } - ownership_audit_reports: { - Row: { - details: Json - duration_ms: number | null - generated_at: string - id: string - missing_user_count: number - null_owner_count: number - rls_coverage: Json - rls_gaps_count: number - total_issues_found: number - total_tables_scanned: number - triggered_by: string - } - Insert: { - details?: Json - duration_ms?: number | null - generated_at?: string - id?: string - missing_user_count?: number - null_owner_count?: number - rls_coverage?: Json - rls_gaps_count?: number - total_issues_found?: number - total_tables_scanned?: number - triggered_by?: string - } - Update: { - details?: Json - duration_ms?: number | null - generated_at?: string - id?: string - missing_user_count?: number - null_owner_count?: number - rls_coverage?: Json - rls_gaps_count?: number - total_issues_found?: number - total_tables_scanned?: number - triggered_by?: string + user_id?: string } Relationships: [] } - ownership_repair_logs: { + feminine_color_config: { Row: { - action: string - created_at: string - dry_run: boolean - error_message: string | null - id: string - issue_type: string + color_group_id: string + color_group_name: string + created_at: string | null + is_active: boolean | null notes: string | null - owner_column: string - report_id: string | null - rows_affected: number - table_name: string - triggered_by: string | null - triggered_by_label: string | null } Insert: { - action: string - created_at?: string - dry_run?: boolean - error_message?: string | null - id?: string - issue_type: string + color_group_id: string + color_group_name: string + created_at?: string | null + is_active?: boolean | null notes?: string | null - owner_column: string - report_id?: string | null - rows_affected?: number - table_name: string - triggered_by?: string | null - triggered_by_label?: string | null } Update: { - action?: string - created_at?: string - dry_run?: boolean - error_message?: string | null - id?: string - issue_type?: string + color_group_id?: string + color_group_name?: string + created_at?: string | null + is_active?: boolean | null notes?: string | null - owner_column?: string - report_id?: string | null - rows_affected?: number - table_name?: string - triggered_by?: string | null - triggered_by_label?: string | null } Relationships: [ { - foreignKeyName: "ownership_repair_logs_report_id_fkey" - columns: ["report_id"] - isOneToOne: false - referencedRelation: "ownership_audit_reports" + foreignKeyName: "feminine_color_config_color_group_id_fkey" + columns: ["color_group_id"] + isOneToOne: true + referencedRelation: "color_groups" referencedColumns: ["id"] }, + { + foreignKeyName: "feminine_color_config_color_group_id_fkey" + columns: ["color_group_id"] + isOneToOne: true + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["promo_group_id"] + }, ] } - password_reset_requests: { + file_scan_logs: { Row: { - email: string + created_at: string + file_hash: string | null + file_name: string + file_size: number | null id: string - requested_at: string | null - reviewed_at: string | null - reviewed_by: string | null - reviewer_notes: string | null - status: string - user_id: string | null + mime_type: string | null + scan_provider: string + scan_response: Json | null + scan_result: string + storage_path: string | null + user_id: string } Insert: { - email: string + created_at?: string + file_hash?: string | null + file_name: string + file_size?: number | null id?: string - requested_at?: string | null - reviewed_at?: string | null - reviewed_by?: string | null - reviewer_notes?: string | null - status?: string - user_id?: string | null + mime_type?: string | null + scan_provider?: string + scan_response?: Json | null + scan_result?: string + storage_path?: string | null + user_id: string } Update: { - email?: string + created_at?: string + file_hash?: string | null + file_name?: string + file_size?: number | null id?: string - requested_at?: string | null - reviewed_at?: string | null - reviewed_by?: string | null - reviewer_notes?: string | null - status?: string - user_id?: string | null + mime_type?: string | null + scan_provider?: string + scan_response?: Json | null + scan_result?: string + storage_path?: string | null + user_id?: string } Relationships: [] } - permissions: { + follow_up_reminders: { Row: { - category: string - code: string + completed_at: string | null created_at: string - description: string | null - label: string + id: string + is_completed: boolean + is_sent: boolean + notes: string | null + quote_id: string + reminder_type: string + scheduled_for: string + seller_id: string + sent_at: string | null + title: string | null } Insert: { - category?: string - code: string + completed_at?: string | null created_at?: string - description?: string | null - label: string + id?: string + is_completed?: boolean + is_sent?: boolean + notes?: string | null + quote_id: string + reminder_type?: string + scheduled_for: string + seller_id: string + sent_at?: string | null + title?: string | null } Update: { - category?: string - code?: string + completed_at?: string | null created_at?: string - description?: string | null - label?: string + id?: string + is_completed?: boolean + is_sent?: boolean + notes?: string | null + quote_id?: string + reminder_type?: string + scheduled_for?: string + seller_id?: string + sent_at?: string | null + title?: string | null } Relationships: [] } - price_history: { + frontend_telemetry: { Row: { - change_reason: string | null - change_type: string - changed_at: string | null - changed_by: string | null + created_at: string + duration_ms: number | null + event_type: string id: string - new_values: Json | null - old_values: Json | null - source: string | null - variant_id: string + metadata: Json | null + name: string + session_id: string | null + url: string | null + user_agent: string | null + user_id: string | null } Insert: { - change_reason?: string | null - change_type: string - changed_at?: string | null - changed_by?: string | null + created_at?: string + duration_ms?: number | null + event_type: string id?: string - new_values?: Json | null - old_values?: Json | null - source?: string | null - variant_id: string + metadata?: Json | null + name: string + session_id?: string | null + url?: string | null + user_agent?: string | null + user_id?: string | null } Update: { - change_reason?: string | null - change_type?: string - changed_at?: string | null - changed_by?: string | null + created_at?: string + duration_ms?: number | null + event_type?: string id?: string - new_values?: Json | null - old_values?: Json | null - source?: string | null - variant_id?: string + metadata?: Json | null + name?: string + session_id?: string | null + url?: string | null + user_agent?: string | null + user_id?: string | null } Relationships: [] } - product_component_locations: { + generated_mockups: { Row: { - component_id: string - created_at: string - description: string | null - id: string - is_active: boolean - location_code: string - location_name: string - max_height_cm: number | null - max_width_cm: number | null - sort_order: number | null + ai_model_used: string + approval_status: string | null + approved_at: string | null + approved_by_user_id: string | null + area_config: Json + area_name: string + client_feedback: string | null + created_at: string + error_details: string | null + generation_cost: number | null + generation_time_seconds: number | null + has_errors: boolean | null + id: string + job_id: string + logo_url: string + mockup_url: string + product_color_hex: string + product_color_name: string | null + product_id: string | null + product_name: string + product_sku: string | null + prompt_used: string | null + quality_score: number | null + seed_used: number | null + technique_id: string | null + technique_name: string + thumbnail_url: string | null updated_at: string + user_id: string } Insert: { - component_id: string + ai_model_used: string + approval_status?: string | null + approved_at?: string | null + approved_by_user_id?: string | null + area_config: Json + area_name: string + client_feedback?: string | null created_at?: string - description?: string | null + error_details?: string | null + generation_cost?: number | null + generation_time_seconds?: number | null + has_errors?: boolean | null id?: string - is_active?: boolean - location_code: string - location_name: string - max_height_cm?: number | null - max_width_cm?: number | null - sort_order?: number | null + job_id: string + logo_url: string + mockup_url: string + product_color_hex: string + product_color_name?: string | null + product_id?: string | null + product_name: string + product_sku?: string | null + prompt_used?: string | null + quality_score?: number | null + seed_used?: number | null + technique_id?: string | null + technique_name: string + thumbnail_url?: string | null updated_at?: string + user_id: string } Update: { - component_id?: string + ai_model_used?: string + approval_status?: string | null + approved_at?: string | null + approved_by_user_id?: string | null + area_config?: Json + area_name?: string + client_feedback?: string | null created_at?: string - description?: string | null + error_details?: string | null + generation_cost?: number | null + generation_time_seconds?: number | null + has_errors?: boolean | null id?: string - is_active?: boolean - location_code?: string - location_name?: string - max_height_cm?: number | null - max_width_cm?: number | null - sort_order?: number | null + job_id?: string + logo_url?: string + mockup_url?: string + product_color_hex?: string + product_color_name?: string | null + product_id?: string | null + product_name?: string + product_sku?: string | null + prompt_used?: string | null + quality_score?: number | null + seed_used?: number | null + technique_id?: string | null + technique_name?: string + thumbnail_url?: string | null updated_at?: string + user_id?: string } Relationships: [ { - foreignKeyName: "product_component_locations_component_id_fkey" - columns: ["component_id"] + foreignKeyName: "generated_mockups_job_id_fkey" + columns: ["job_id"] isOneToOne: false - referencedRelation: "product_components" + referencedRelation: "mockup_generation_jobs" + referencedColumns: ["id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "generated_mockups_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "generated_mockups_technique_id_fkey" + columns: ["technique_id"] + isOneToOne: false + referencedRelation: "personalization_techniques" referencedColumns: ["id"] }, ] } - product_components: { + geo_allowed_countries: { Row: { - component_code: string - component_name: string - created_at: string + country_code: string + country_name: string + created_at: string | null + created_by: string | null id: string - is_active: boolean - is_personalizable: boolean - product_id: string - sort_order: number | null - updated_at: string + is_active: boolean | null } Insert: { - component_code: string - component_name: string - created_at?: string + country_code: string + country_name: string + created_at?: string | null + created_by?: string | null id?: string - is_active?: boolean - is_personalizable?: boolean - product_id: string - sort_order?: number | null - updated_at?: string + is_active?: boolean | null } Update: { - component_code?: string - component_name?: string - created_at?: string + country_code?: string + country_name?: string + created_at?: string | null + created_by?: string | null id?: string - is_active?: boolean - is_personalizable?: boolean - product_id?: string - sort_order?: number | null - updated_at?: string + is_active?: boolean | null } Relationships: [] } - product_group_members: { + hardening_health_snapshots: { Row: { created_at: string + details: Json + failures: string[] id: string - product_group_id: string - product_id: string - updated_at: string - use_group_rules: boolean + max_score: number + score: number + snapshot_at: string } Insert: { created_at?: string + details?: Json + failures?: string[] id?: string - product_group_id: string - product_id: string - updated_at?: string - use_group_rules?: boolean + max_score?: number + score: number + snapshot_at?: string } Update: { created_at?: string + details?: Json + failures?: string[] id?: string - product_group_id?: string - product_id?: string - updated_at?: string - use_group_rules?: boolean + max_score?: number + score?: number + snapshot_at?: string } - Relationships: [ - { - foreignKeyName: "product_group_members_product_group_id_fkey" - columns: ["product_group_id"] - isOneToOne: false - referencedRelation: "product_groups" - referencedColumns: ["id"] - }, - ] + Relationships: [] } - product_groups: { + image_import_log: { Row: { - created_at: string + cloudflare_image_id: string | null + error_message: string | null + id: string + import_status: string | null + imported_at: string | null + original_created_at: string | null + parsed_color_code: string | null + parsed_sku: string | null + product_id: string | null + sha256_hash: string | null + source_type: string + source_url: string | null + source_zip: string | null + supplier_ref_id: string | null + } + Insert: { + cloudflare_image_id?: string | null + error_message?: string | null + id?: string + import_status?: string | null + imported_at?: string | null + original_created_at?: string | null + parsed_color_code?: string | null + parsed_sku?: string | null + product_id?: string | null + sha256_hash?: string | null + source_type: string + source_url?: string | null + source_zip?: string | null + supplier_ref_id?: string | null + } + Update: { + cloudflare_image_id?: string | null + error_message?: string | null + id?: string + import_status?: string | null + imported_at?: string | null + original_created_at?: string | null + parsed_color_code?: string | null + parsed_sku?: string | null + product_id?: string | null + sha256_hash?: string | null + source_type?: string + source_url?: string | null + source_zip?: string | null + supplier_ref_id?: string | null + } + Relationships: [] + } + image_types: { + Row: { + category: string + code: string + created_at: string | null description: string | null - group_code: string - group_name: string + description_en: string | null + display_priority: number | null + gallery_order: number | null + icon: string | null id: string - is_active: boolean - updated_at: string + is_active: boolean | null + is_color_specific: boolean | null + is_internal_only: boolean | null + is_primary_candidate: boolean | null + name: string + name_en: string | null + requires_variant: boolean | null + show_in_gallery: boolean | null + show_in_simulator: boolean | null + subcategory: string | null + ui_color: string | null + updated_at: string | null } Insert: { - created_at?: string + category?: string + code: string + created_at?: string | null description?: string | null - group_code: string - group_name: string + description_en?: string | null + display_priority?: number | null + gallery_order?: number | null + icon?: string | null id?: string - is_active?: boolean - updated_at?: string + is_active?: boolean | null + is_color_specific?: boolean | null + is_internal_only?: boolean | null + is_primary_candidate?: boolean | null + name: string + name_en?: string | null + requires_variant?: boolean | null + show_in_gallery?: boolean | null + show_in_simulator?: boolean | null + subcategory?: string | null + ui_color?: string | null + updated_at?: string | null } Update: { - created_at?: string + category?: string + code?: string + created_at?: string | null description?: string | null - group_code?: string - group_name?: string + description_en?: string | null + display_priority?: number | null + gallery_order?: number | null + icon?: string | null id?: string - is_active?: boolean - updated_at?: string + is_active?: boolean | null + is_color_specific?: boolean | null + is_internal_only?: boolean | null + is_primary_candidate?: boolean | null + name?: string + name_en?: string | null + requires_variant?: boolean | null + show_in_gallery?: boolean | null + show_in_simulator?: boolean | null + subcategory?: string | null + ui_color?: string | null + updated_at?: string | null } Relationships: [] } - product_price_freshness_overrides: { + image_validation_log: { Row: { - created_at: string + action_taken: string | null + file_size_bytes: number | null + filename: string | null + height_px: number | null id: string - product_id: string - threshold_days: number - updated_at: string - updated_by: string | null + image_id: string + is_valid: boolean + issues: string[] | null + product_id: string | null + recommendations: string[] | null + supplier_code: string | null + validated_at: string | null + validation_status: string + was_blocked: boolean | null + width_px: number | null } Insert: { - created_at?: string + action_taken?: string | null + file_size_bytes?: number | null + filename?: string | null + height_px?: number | null id?: string - product_id: string - threshold_days: number - updated_at?: string - updated_by?: string | null + image_id: string + is_valid?: boolean + issues?: string[] | null + product_id?: string | null + recommendations?: string[] | null + supplier_code?: string | null + validated_at?: string | null + validation_status: string + was_blocked?: boolean | null + width_px?: number | null } Update: { - created_at?: string + action_taken?: string | null + file_size_bytes?: number | null + filename?: string | null + height_px?: number | null id?: string - product_id?: string - threshold_days?: number - updated_at?: string - updated_by?: string | null + image_id?: string + is_valid?: boolean + issues?: string[] | null + product_id?: string | null + recommendations?: string[] | null + supplier_code?: string | null + validated_at?: string | null + validation_status?: string + was_blocked?: boolean | null + width_px?: number | null } - Relationships: [] + Relationships: [ + { + foreignKeyName: "fk_image_validation_image" + columns: ["image_id"] + isOneToOne: false + referencedRelation: "product_images" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_image_validation_image" + columns: ["image_id"] + isOneToOne: false + referencedRelation: "v_images_below_requirements" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_image_validation_image" + columns: ["image_id"] + isOneToOne: false + referencedRelation: "v_media_combined" + referencedColumns: ["product_image_id"] + }, + { + foreignKeyName: "fk_image_validation_image" + columns: ["image_id"] + isOneToOne: false + referencedRelation: "v_product_images_cdn" + referencedColumns: ["id"] + }, + ] } - product_sync_logs: { + import_pipeline_steps: { Row: { + comando_resumo: string | null completed_at: string | null - created_at: string - duration_ms: number | null + created_at: string | null + dependencia: number[] | null + descricao: string | null error_message: string | null - id: string - payload: Json | null - products_created: number | null - products_failed: number | null - products_received: number | null - products_updated: number | null - records_failed: number - records_inserted: number - records_processed: number - records_updated: number - source: string + etapa: number + fase: string + id: number + resultado: Json | null + started_at: string | null status: string - triggered_by: string | null + titulo: string + updated_at: string | null } Insert: { + comando_resumo?: string | null completed_at?: string | null - created_at?: string - duration_ms?: number | null + created_at?: string | null + dependencia?: number[] | null + descricao?: string | null error_message?: string | null - id?: string - payload?: Json | null - products_created?: number | null - products_failed?: number | null - products_received?: number | null - products_updated?: number | null - records_failed?: number - records_inserted?: number - records_processed?: number - records_updated?: number - source: string + etapa: number + fase: string + id?: number + resultado?: Json | null + started_at?: string | null status?: string - triggered_by?: string | null + titulo: string + updated_at?: string | null } Update: { + comando_resumo?: string | null completed_at?: string | null - created_at?: string - duration_ms?: number | null + created_at?: string | null + dependencia?: number[] | null + descricao?: string | null error_message?: string | null - id?: string - payload?: Json | null - products_created?: number | null - products_failed?: number | null - products_received?: number | null - products_updated?: number | null - records_failed?: number - records_inserted?: number - records_processed?: number - records_updated?: number - source?: string + etapa?: number + fase?: string + id?: number + resultado?: Json | null + started_at?: string | null status?: string - triggered_by?: string | null + titulo?: string + updated_at?: string | null } Relationships: [] } - product_views: { + import_staging_images: { Row: { - created_at: string + batch_id: string | null + cloudflare_image_id: string | null + color_id: string | null + completed_at: string | null + created_at: string | null + error_message: string | null + file_size_bytes: number | null + filename: string id: string + parsed_color_code: string + parsed_component: number + parsed_location: number + parsed_sku: string + parsed_view: number + processed_at: string | null product_id: string | null - product_name: string | null - product_sku: string | null - seller_id: string | null - view_type: string | null + product_image_id: string | null + retry_count: number | null + source_folder: string | null + source_zip: string | null + status: string + target_display_order: number | null + target_image_type: string | null + target_image_type_id: string | null + updated_at: string | null + uploaded_at: string | null + url_cdn: string | null + variant_id: string | null } Insert: { - created_at?: string + batch_id?: string | null + cloudflare_image_id?: string | null + color_id?: string | null + completed_at?: string | null + created_at?: string | null + error_message?: string | null + file_size_bytes?: number | null + filename: string id?: string + parsed_color_code: string + parsed_component?: number + parsed_location?: number + parsed_sku: string + parsed_view?: number + processed_at?: string | null product_id?: string | null - product_name?: string | null - product_sku?: string | null - seller_id?: string | null - view_type?: string | null + product_image_id?: string | null + retry_count?: number | null + source_folder?: string | null + source_zip?: string | null + status?: string + target_display_order?: number | null + target_image_type?: string | null + target_image_type_id?: string | null + updated_at?: string | null + uploaded_at?: string | null + url_cdn?: string | null + variant_id?: string | null } Update: { - created_at?: string + batch_id?: string | null + cloudflare_image_id?: string | null + color_id?: string | null + completed_at?: string | null + created_at?: string | null + error_message?: string | null + file_size_bytes?: number | null + filename?: string id?: string + parsed_color_code?: string + parsed_component?: number + parsed_location?: number + parsed_sku?: string + parsed_view?: number + processed_at?: string | null product_id?: string | null - product_name?: string | null - product_sku?: string | null - seller_id?: string | null - view_type?: string | null + product_image_id?: string | null + retry_count?: number | null + source_folder?: string | null + source_zip?: string | null + status?: string + target_display_order?: number | null + target_image_type?: string | null + target_image_type_id?: string | null + updated_at?: string | null + uploaded_at?: string | null + url_cdn?: string | null + variant_id?: string | null } Relationships: [] } - products: { + inbound_webhook_endpoints: { Row: { - category_id: string | null - category_name: string | null - colors: Json | null - created_at: string | null + allowed_events: string[] | null + allowed_ips: string[] | null + created_at: string + created_by: string | null description: string | null - external_id: string | null - featured: boolean | null + hmac_secret_ref: string | null id: string - images: string[] | null - is_active: boolean | null - is_kit: boolean | null - kit_items: Json | null - materials: string[] | null + is_active: boolean + last_received_at: string | null metadata: Json | null name: string - new_arrival: boolean | null - on_sale: boolean | null - price: number | null - sku: string | null - stock: number | null - stock_quantity: number | null - stock_status: string | null - subcategory: string | null - supplier_id: string | null - supplier_name: string | null - synced_at: string | null - tags: Json | null - updated_at: string | null - variations: Json | null - video_url: string | null + secret_key: string | null + slug: string + source_system: string | null + total_invalid: number + total_received: number + updated_at: string } Insert: { - category_id?: string | null - category_name?: string | null - colors?: Json | null - created_at?: string | null + allowed_events?: string[] | null + allowed_ips?: string[] | null + created_at?: string + created_by?: string | null description?: string | null - external_id?: string | null - featured?: boolean | null + hmac_secret_ref?: string | null id?: string - images?: string[] | null - is_active?: boolean | null - is_kit?: boolean | null - kit_items?: Json | null - materials?: string[] | null + is_active?: boolean + last_received_at?: string | null metadata?: Json | null name: string - new_arrival?: boolean | null - on_sale?: boolean | null - price?: number | null - sku?: string | null - stock?: number | null - stock_quantity?: number | null - stock_status?: string | null - subcategory?: string | null - supplier_id?: string | null - supplier_name?: string | null - synced_at?: string | null - tags?: Json | null - updated_at?: string | null - variations?: Json | null - video_url?: string | null + secret_key?: string | null + slug: string + source_system?: string | null + total_invalid?: number + total_received?: number + updated_at?: string } Update: { - category_id?: string | null - category_name?: string | null - colors?: Json | null - created_at?: string | null + allowed_events?: string[] | null + allowed_ips?: string[] | null + created_at?: string + created_by?: string | null description?: string | null - external_id?: string | null - featured?: boolean | null + hmac_secret_ref?: string | null id?: string - images?: string[] | null - is_active?: boolean | null - is_kit?: boolean | null - kit_items?: Json | null - materials?: string[] | null + is_active?: boolean + last_received_at?: string | null metadata?: Json | null name?: string - new_arrival?: boolean | null - on_sale?: boolean | null - price?: number | null - sku?: string | null - stock?: number | null - stock_quantity?: number | null - stock_status?: string | null - subcategory?: string | null - supplier_id?: string | null - supplier_name?: string | null - synced_at?: string | null - tags?: Json | null - updated_at?: string | null - variations?: Json | null - video_url?: string | null + secret_key?: string | null + slug?: string + source_system?: string | null + total_invalid?: number + total_received?: number + updated_at?: string } Relationships: [] } - profiles: { + inbound_webhook_events: { Row: { - avatar_url: string | null - bitrix_id: number | null + contract_version: string created_at: string - department: string | null - email: string | null - full_name: string | null + endpoint_id: string | null + error_message: string | null + event_type: string + headers: Json | null id: string - is_active: boolean | null - last_login_at: string | null - phone: string | null - preferences: Json | null - role: string | null + ip_address: string | null + payload: Json + processed: boolean + processed_at: string | null + signature_valid: boolean | null + } + Insert: { + contract_version?: string + created_at?: string + endpoint_id?: string | null + error_message?: string | null + event_type: string + headers?: Json | null + id?: string + ip_address?: string | null + payload: Json + processed?: boolean + processed_at?: string | null + signature_valid?: boolean | null + } + Update: { + contract_version?: string + created_at?: string + endpoint_id?: string | null + error_message?: string | null + event_type?: string + headers?: Json | null + id?: string + ip_address?: string | null + payload?: Json + processed?: boolean + processed_at?: string | null + signature_valid?: boolean | null + } + Relationships: [ + { + foreignKeyName: "inbound_webhook_events_endpoint_id_fkey" + columns: ["endpoint_id"] + isOneToOne: false + referencedRelation: "inbound_webhook_endpoints" + referencedColumns: ["id"] + }, + ] + } + integration_credentials: { + Row: { + created_at: string + created_by: string | null + credential_type: string + description: string | null + expires_at: string | null + id: string + is_active: boolean + length: number | null + masked_suffix: string | null + metadata: Json | null + notes: string | null + provider: string + secret_name: string + secret_value: string updated_at: string - user_id: string + updated_by: string | null } Insert: { - avatar_url?: string | null - bitrix_id?: number | null created_at?: string - department?: string | null - email?: string | null - full_name?: string | null + created_by?: string | null + credential_type?: string + description?: string | null + expires_at?: string | null id?: string - is_active?: boolean | null - last_login_at?: string | null - phone?: string | null - preferences?: Json | null - role?: string | null + is_active?: boolean + length?: number | null + masked_suffix?: string | null + metadata?: Json | null + notes?: string | null + provider: string + secret_name: string + secret_value: string updated_at?: string - user_id: string + updated_by?: string | null } Update: { - avatar_url?: string | null - bitrix_id?: number | null created_at?: string - department?: string | null - email?: string | null - full_name?: string | null + created_by?: string | null + credential_type?: string + description?: string | null + expires_at?: string | null id?: string - is_active?: boolean | null - last_login_at?: string | null - phone?: string | null - preferences?: Json | null - role?: string | null + is_active?: boolean + length?: number | null + masked_suffix?: string | null + metadata?: Json | null + notes?: string | null + provider?: string + secret_name?: string + secret_value?: string updated_at?: string - user_id?: string + updated_by?: string | null } Relationships: [] } - public_token_failures: { + ip_access_control: { Row: { - attempted_token: string | null created_at: string + created_by: string | null + expires_at: string | null id: string - ip_address: string | null + ip_address: string + list_type: string + metadata: Json | null reason: string | null - resource_id: string | null - resource_type: string - user_agent: string | null + updated_at: string | null } Insert: { - attempted_token?: string | null created_at?: string + created_by?: string | null + expires_at?: string | null id?: string - ip_address?: string | null + ip_address: string + list_type: string + metadata?: Json | null reason?: string | null - resource_id?: string | null - resource_type: string - user_agent?: string | null + updated_at?: string | null } Update: { - attempted_token?: string | null created_at?: string + created_by?: string | null + expires_at?: string | null id?: string - ip_address?: string | null + ip_address?: string + list_type?: string + metadata?: Json | null reason?: string | null - resource_id?: string | null - resource_type?: string - user_agent?: string | null + updated_at?: string | null } Relationships: [] } - query_telemetry: { + ip_whitelist: { Row: { - cache_hit: boolean - count_mode: string | null created_at: string - duration_ms: number - error_kind: string | null - error_message: string | null id: string - is_503: boolean - is_cold_start: boolean - operation: string - query_limit: number | null - query_offset: number | null - record_count: number | null - retry_count: number - rpc_name: string | null - severity: string - table_name: string | null - user_id: string | null + ip_address: string + is_active: boolean + label: string | null } Insert: { - cache_hit?: boolean - count_mode?: string | null created_at?: string - duration_ms: number - error_kind?: string | null - error_message?: string | null id?: string - is_503?: boolean - is_cold_start?: boolean - operation: string - query_limit?: number | null - query_offset?: number | null - record_count?: number | null - retry_count?: number - rpc_name?: string | null - severity?: string - table_name?: string | null - user_id?: string | null + ip_address: string + is_active?: boolean + label?: string | null } Update: { - cache_hit?: boolean - count_mode?: string | null created_at?: string - duration_ms?: number - error_kind?: string | null - error_message?: string | null id?: string - is_503?: boolean - is_cold_start?: boolean - operation?: string - query_limit?: number | null - query_offset?: number | null - record_count?: number | null - retry_count?: number - rpc_name?: string | null - severity?: string - table_name?: string | null - user_id?: string | null + ip_address?: string + is_active?: boolean + label?: string | null } Relationships: [] } - quote_approval_tokens: { + kill_switch_hits: { Row: { - client_email: string | null - client_name: string | null - created_at: string - expires_at: string | null - id: string - quote_id: string - responded_at: string | null - response: string | null - response_notes: string | null - seller_id: string - signature_hash: string | null - signed_at: string | null - signer_document: string | null - signer_ip: string | null - signer_name: string | null - signer_user_agent: string | null - status: string - token: string - updated_at: string - viewed_at: string | null + id: number + occurred_at: string + operation: string | null + origin: string | null + source: string + switch_name: string + target: string | null + user_role: string | null } Insert: { - client_email?: string | null - client_name?: string | null - created_at?: string - expires_at?: string | null - id?: string - quote_id: string - responded_at?: string | null - response?: string | null - response_notes?: string | null - seller_id: string - signature_hash?: string | null - signed_at?: string | null - signer_document?: string | null - signer_ip?: string | null - signer_name?: string | null - signer_user_agent?: string | null - status?: string - token?: string - updated_at?: string - viewed_at?: string | null + id?: number + occurred_at?: string + operation?: string | null + origin?: string | null + source: string + switch_name: string + target?: string | null + user_role?: string | null } Update: { - client_email?: string | null - client_name?: string | null - created_at?: string - expires_at?: string | null - id?: string - quote_id?: string - responded_at?: string | null - response?: string | null - response_notes?: string | null - seller_id?: string - signature_hash?: string | null - signed_at?: string | null - signer_document?: string | null - signer_ip?: string | null - signer_name?: string | null - signer_user_agent?: string | null - status?: string - token?: string - updated_at?: string - viewed_at?: string | null + id?: number + occurred_at?: string + operation?: string | null + origin?: string | null + source?: string + switch_name?: string + target?: string | null + user_role?: string | null } Relationships: [] } - quote_comments: { + kit_collaborators: { Row: { - comment: string created_at: string id: string - is_internal: boolean - quote_id: string + invited_by: string | null + invited_email: string | null + kit_id: string + permission: string updated_at: string user_id: string } Insert: { - comment: string created_at?: string id?: string - is_internal?: boolean - quote_id: string + invited_by?: string | null + invited_email?: string | null + kit_id: string + permission?: string updated_at?: string user_id: string } Update: { - comment?: string created_at?: string id?: string - is_internal?: boolean - quote_id?: string + invited_by?: string | null + invited_email?: string | null + kit_id?: string + permission?: string updated_at?: string user_id?: string } - Relationships: [] - } - quote_drafts: { - Row: { - data: Json - id: string - last_saved_at: string | null - user_id: string - } - Insert: { - data: Json - id?: string - last_saved_at?: string | null - user_id: string - } - Update: { - data?: Json - id?: string - last_saved_at?: string | null - user_id?: string - } - Relationships: [] + Relationships: [ + { + foreignKeyName: "kit_collaborators_kit_id_fkey" + columns: ["kit_id"] + isOneToOne: false + referencedRelation: "custom_kits" + referencedColumns: ["id"] + }, + ] } - quote_history: { + kit_comments: { Row: { - action: string + author_id: string + body: string created_at: string - description: string | null - field_changed: string | null id: string - metadata: Json | null - new_value: string | null - old_value: string | null - quote_id: string - user_id: string | null + item_anchor: string | null + kit_id: string + parent_id: string | null + resolved: boolean + updated_at: string } Insert: { - action: string + author_id: string + body: string created_at?: string - description?: string | null - field_changed?: string | null id?: string - metadata?: Json | null - new_value?: string | null - old_value?: string | null - quote_id: string - user_id?: string | null + item_anchor?: string | null + kit_id: string + parent_id?: string | null + resolved?: boolean + updated_at?: string } Update: { - action?: string + author_id?: string + body?: string created_at?: string - description?: string | null - field_changed?: string | null id?: string - metadata?: Json | null - new_value?: string | null - old_value?: string | null - quote_id?: string - user_id?: string | null + item_anchor?: string | null + kit_id?: string + parent_id?: string | null + resolved?: boolean + updated_at?: string } Relationships: [ { - foreignKeyName: "quote_history_quote_id_fkey" - columns: ["quote_id"] + foreignKeyName: "kit_comments_kit_id_fkey" + columns: ["kit_id"] isOneToOne: false - referencedRelation: "quotes" + referencedRelation: "custom_kits" + referencedColumns: ["id"] + }, + { + foreignKeyName: "kit_comments_parent_id_fkey" + columns: ["parent_id"] + isOneToOne: false + referencedRelation: "kit_comments" referencedColumns: ["id"] }, ] } - quote_item_personalizations: { + kit_component_print_areas: { Row: { - area_cm2: number | null - colors_count: number | null - created_at: string - height_cm: number | null + created_at: string | null id: string - location_code: string | null + is_active: boolean + is_curved: boolean + kit_component_id: string + location_code: string location_name: string | null - notes: string | null - personalized_quantity: number | null - positions_count: number | null - quote_item_id: string - setup_cost: number | null - technique_id: string | null - technique_name: string | null - total_cost: number | null - unit_cost: number | null - updated_at: string - width_cm: number | null + location_order: number | null + max_height: number + max_width: number + shape: string + tabela_preco_id: string + technique_order: number + updated_at: string | null } Insert: { - area_cm2?: number | null - colors_count?: number | null - created_at?: string - height_cm?: number | null + created_at?: string | null id?: string - location_code?: string | null + is_active?: boolean + is_curved?: boolean + kit_component_id: string + location_code: string location_name?: string | null - notes?: string | null - personalized_quantity?: number | null - positions_count?: number | null - quote_item_id: string - setup_cost?: number | null - technique_id?: string | null - technique_name?: string | null - total_cost?: number | null - unit_cost?: number | null - updated_at?: string - width_cm?: number | null + location_order?: number | null + max_height: number + max_width: number + shape?: string + tabela_preco_id: string + technique_order?: number + updated_at?: string | null } Update: { - area_cm2?: number | null - colors_count?: number | null - created_at?: string - height_cm?: number | null + created_at?: string | null id?: string - location_code?: string | null + is_active?: boolean + is_curved?: boolean + kit_component_id?: string + location_code?: string location_name?: string | null - notes?: string | null - personalized_quantity?: number | null - positions_count?: number | null - quote_item_id?: string - setup_cost?: number | null - technique_id?: string | null - technique_name?: string | null - total_cost?: number | null - unit_cost?: number | null - updated_at?: string - width_cm?: number | null + location_order?: number | null + max_height?: number + max_width?: number + shape?: string + tabela_preco_id?: string + technique_order?: number + updated_at?: string | null } Relationships: [ { - foreignKeyName: "quote_item_personalizations_quote_item_id_fkey" - columns: ["quote_item_id"] + foreignKeyName: "kit_component_print_areas_kit_component_id_fkey" + columns: ["kit_component_id"] isOneToOne: false - referencedRelation: "quote_items" + referencedRelation: "product_kit_components" + referencedColumns: ["id"] + }, + { + foreignKeyName: "kit_component_print_areas_kit_component_id_fkey" + columns: ["kit_component_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["component_id"] + }, + { + foreignKeyName: "kit_component_print_areas_tabela_preco_id_fkey" + columns: ["tabela_preco_id"] + isOneToOne: false + referencedRelation: "tabela_preco_gravacao_oficial" referencedColumns: ["id"] }, ] } - quote_items: { + kit_component_types: { Row: { - artwork_urls: Json | null - bitrix_product_id: string | null - color_hex: string | null - color_name: string | null - created_at: string - discount_amount: number | null - discount_percentage: number | null - gender: string | null - has_personalization: boolean | null + category: string | null + code: string + created_at: string | null + default_material_type_id: string | null + description: string | null + display_order: number | null + icon: string | null id: string - kit_group_id: string | null - kit_name: string | null - mockup_urls: Json | null - notes: string | null - personalization_config: Json | null - personalization_cost: number | null - price_confirmed_at: string | null - price_freshness_threshold_days: number | null - price_updated_at: string | null - product_description: string | null - product_id: string | null - product_image_url: string | null - product_name: string - product_sku: string | null - quantity: number - quote_id: string - size_code: string | null - sort_order: number | null - subtotal: number | null - unit_price: number + is_active: boolean | null + is_personalizable_by_default: boolean + name: string + name_plural: string | null + secondary_material_type_id: string | null + typical_height_mm: number | null + typical_length_mm: number | null + typical_weight_g: number | null + typical_width_mm: number | null + updated_at: string | null + } + Insert: { + category?: string | null + code: string + created_at?: string | null + default_material_type_id?: string | null + description?: string | null + display_order?: number | null + icon?: string | null + id?: string + is_active?: boolean | null + is_personalizable_by_default?: boolean + name: string + name_plural?: string | null + secondary_material_type_id?: string | null + typical_height_mm?: number | null + typical_length_mm?: number | null + typical_weight_g?: number | null + typical_width_mm?: number | null + updated_at?: string | null + } + Update: { + category?: string | null + code?: string + created_at?: string | null + default_material_type_id?: string | null + description?: string | null + display_order?: number | null + icon?: string | null + id?: string + is_active?: boolean | null + is_personalizable_by_default?: boolean + name?: string + name_plural?: string | null + secondary_material_type_id?: string | null + typical_height_mm?: number | null + typical_length_mm?: number | null + typical_weight_g?: number | null + typical_width_mm?: number | null + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "kit_component_types_default_material_type_id_fkey" + columns: ["default_material_type_id"] + isOneToOne: false + referencedRelation: "material_types" + referencedColumns: ["id"] + }, + { + foreignKeyName: "kit_component_types_default_material_type_id_fkey" + columns: ["default_material_type_id"] + isOneToOne: false + referencedRelation: "materials_complete" + referencedColumns: ["material_id"] + }, + { + foreignKeyName: "kit_component_types_default_material_type_id_fkey" + columns: ["default_material_type_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["material_id"] + }, + { + foreignKeyName: "kit_component_types_secondary_material_type_id_fkey" + columns: ["secondary_material_type_id"] + isOneToOne: false + referencedRelation: "material_types" + referencedColumns: ["id"] + }, + { + foreignKeyName: "kit_component_types_secondary_material_type_id_fkey" + columns: ["secondary_material_type_id"] + isOneToOne: false + referencedRelation: "materials_complete" + referencedColumns: ["material_id"] + }, + { + foreignKeyName: "kit_component_types_secondary_material_type_id_fkey" + columns: ["secondary_material_type_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["material_id"] + }, + ] + } + kit_share_tokens: { + Row: { + client_email: string | null + client_name: string | null + created_at: string + expires_at: string | null + id: string + kit_id: string + seller_id: string + status: string + token: string updated_at: string + viewed_at: string | null } Insert: { - artwork_urls?: Json | null - bitrix_product_id?: string | null - color_hex?: string | null - color_name?: string | null + client_email?: string | null + client_name?: string | null created_at?: string - discount_amount?: number | null - discount_percentage?: number | null - gender?: string | null - has_personalization?: boolean | null + expires_at?: string | null id?: string - kit_group_id?: string | null - kit_name?: string | null - mockup_urls?: Json | null - notes?: string | null - personalization_config?: Json | null - personalization_cost?: number | null - price_confirmed_at?: string | null - price_freshness_threshold_days?: number | null - price_updated_at?: string | null - product_description?: string | null - product_id?: string | null - product_image_url?: string | null - product_name: string - product_sku?: string | null - quantity?: number - quote_id: string - size_code?: string | null - sort_order?: number | null - subtotal?: number | null - unit_price?: number + kit_id: string + seller_id: string + status?: string + token?: string updated_at?: string + viewed_at?: string | null } Update: { - artwork_urls?: Json | null - bitrix_product_id?: string | null - color_hex?: string | null - color_name?: string | null + client_email?: string | null + client_name?: string | null created_at?: string - discount_amount?: number | null - discount_percentage?: number | null - gender?: string | null - has_personalization?: boolean | null + expires_at?: string | null id?: string - kit_group_id?: string | null - kit_name?: string | null - mockup_urls?: Json | null - notes?: string | null - personalization_config?: Json | null - personalization_cost?: number | null - price_confirmed_at?: string | null - price_freshness_threshold_days?: number | null - price_updated_at?: string | null - product_description?: string | null - product_id?: string | null - product_image_url?: string | null - product_name?: string - product_sku?: string | null - quantity?: number - quote_id?: string - size_code?: string | null - sort_order?: number | null - subtotal?: number | null - unit_price?: number + kit_id?: string + seller_id?: string + status?: string + token?: string updated_at?: string + viewed_at?: string | null } Relationships: [ { - foreignKeyName: "quote_items_quote_id_fkey" - columns: ["quote_id"] + foreignKeyName: "kit_share_tokens_kit_id_fkey" + columns: ["kit_id"] isOneToOne: false - referencedRelation: "quotes" + referencedRelation: "custom_kits" referencedColumns: ["id"] }, ] } - quote_templates: { + kit_templates: { Row: { - category: string | null + box_data: Json | null + category: string + color: string + cover_image_url: string | null created_at: string created_by: string | null - delivery_time: string | null description: string | null - discount_amount: number | null - discount_percent: number | null + icon: string id: string - internal_notes: string | null is_active: boolean - is_default: boolean | null - items: Json | null + items_data: Json name: string - notes: string | null - payment_terms: string | null - seller_id: string - template_data: Json | null + personalization_data: Json + tag: string | null + total_price: number updated_at: string usage_count: number - validity_days: number | null + volume_usage_percent: number } Insert: { - category?: string | null + box_data?: Json | null + category?: string + color?: string + cover_image_url?: string | null created_at?: string created_by?: string | null - delivery_time?: string | null description?: string | null - discount_amount?: number | null - discount_percent?: number | null + icon?: string id?: string - internal_notes?: string | null is_active?: boolean - is_default?: boolean | null - items?: Json | null + items_data?: Json name: string - notes?: string | null - payment_terms?: string | null - seller_id: string - template_data?: Json | null + personalization_data?: Json + tag?: string | null + total_price?: number updated_at?: string usage_count?: number - validity_days?: number | null + volume_usage_percent?: number } Update: { - category?: string | null + box_data?: Json | null + category?: string + color?: string + cover_image_url?: string | null created_at?: string created_by?: string | null - delivery_time?: string | null description?: string | null - discount_amount?: number | null - discount_percent?: number | null + icon?: string id?: string - internal_notes?: string | null is_active?: boolean - is_default?: boolean | null - items?: Json | null + items_data?: Json name?: string - notes?: string | null - payment_terms?: string | null - seller_id?: string - template_data?: Json | null + personalization_data?: Json + tag?: string | null + total_price?: number updated_at?: string usage_count?: number - validity_days?: number | null + volume_usage_percent?: number } Relationships: [] } - quotes: { + kit_variants: { Row: { - approval_token: string | null - approved_at: string | null - approved_by_client_name: string | null - assigned_to: string | null - bitrix_deal_id: string | null - bitrix_quote_id: string | null - client_cnpj: string | null - client_company: string | null - client_email: string | null - client_feedback: string | null - client_id: string | null - client_name: string | null - client_phone: string | null - client_response: string | null - client_response_at: string | null - client_response_notes: string | null - conversion_notes: string | null - converted_at: string | null - converted_to_order_id: string | null + box_data: Json | null created_at: string - created_by: string | null - delivery_time: string | null - discount_amount: number - discount_percent: number - estimated_delivery_days: number | null id: string - internal_notes: string | null - is_latest_version: boolean - last_sent_at: string | null - negotiation_markup_percent: number - notes: string | null - organization_id: string | null - parent_quote_id: string | null - payment_method: string | null - payment_terms: string | null - priority: string | null - quote_number: string - real_discount_percent: number | null - real_subtotal: number | null - seller_id: string - sent_at: string | null - shipping_cost: number | null - shipping_method: string | null - shipping_type: string | null - stage: string | null - status: string - subtotal: number - synced_at: string | null - synced_to_bitrix: boolean | null - tags: Json | null - tax_amount: number | null - total: number + items_data: Json + kit_master_id: string + kit_quantity: number + label: string + personalization_data: Json + sort_order: number + total_price: number updated_at: string - valid_until: string | null - version: number - view_count: number | null - viewed_at: string | null } Insert: { - approval_token?: string | null - approved_at?: string | null - approved_by_client_name?: string | null - assigned_to?: string | null - bitrix_deal_id?: string | null - bitrix_quote_id?: string | null - client_cnpj?: string | null - client_company?: string | null - client_email?: string | null - client_feedback?: string | null - client_id?: string | null - client_name?: string | null - client_phone?: string | null - client_response?: string | null - client_response_at?: string | null - client_response_notes?: string | null - conversion_notes?: string | null - converted_at?: string | null - converted_to_order_id?: string | null + box_data?: Json | null created_at?: string - created_by?: string | null - delivery_time?: string | null - discount_amount?: number - discount_percent?: number - estimated_delivery_days?: number | null id?: string - internal_notes?: string | null - is_latest_version?: boolean - last_sent_at?: string | null - negotiation_markup_percent?: number - notes?: string | null - organization_id?: string | null - parent_quote_id?: string | null - payment_method?: string | null - payment_terms?: string | null - priority?: string | null - quote_number?: string - real_discount_percent?: number | null - real_subtotal?: number | null - seller_id: string - sent_at?: string | null - shipping_cost?: number | null - shipping_method?: string | null - shipping_type?: string | null - stage?: string | null - status?: string - subtotal?: number - synced_at?: string | null - synced_to_bitrix?: boolean | null - tags?: Json | null - tax_amount?: number | null - total?: number + items_data?: Json + kit_master_id: string + kit_quantity?: number + label: string + personalization_data?: Json + sort_order?: number + total_price?: number updated_at?: string - valid_until?: string | null - version?: number - view_count?: number | null - viewed_at?: string | null } Update: { - approval_token?: string | null - approved_at?: string | null - approved_by_client_name?: string | null - assigned_to?: string | null - bitrix_deal_id?: string | null - bitrix_quote_id?: string | null - client_cnpj?: string | null - client_company?: string | null - client_email?: string | null - client_feedback?: string | null - client_id?: string | null - client_name?: string | null - client_phone?: string | null - client_response?: string | null - client_response_at?: string | null - client_response_notes?: string | null - conversion_notes?: string | null - converted_at?: string | null - converted_to_order_id?: string | null + box_data?: Json | null created_at?: string - created_by?: string | null - delivery_time?: string | null - discount_amount?: number - discount_percent?: number - estimated_delivery_days?: number | null id?: string - internal_notes?: string | null - is_latest_version?: boolean - last_sent_at?: string | null - negotiation_markup_percent?: number - notes?: string | null - organization_id?: string | null - parent_quote_id?: string | null - payment_method?: string | null - payment_terms?: string | null - priority?: string | null - quote_number?: string - real_discount_percent?: number | null - real_subtotal?: number | null - seller_id?: string - sent_at?: string | null - shipping_cost?: number | null - shipping_method?: string | null - shipping_type?: string | null - stage?: string | null - status?: string - subtotal?: number - synced_at?: string | null - synced_to_bitrix?: boolean | null - tags?: Json | null - tax_amount?: number | null - total?: number + items_data?: Json + kit_master_id?: string + kit_quantity?: number + label?: string + personalization_data?: Json + sort_order?: number + total_price?: number updated_at?: string - valid_until?: string | null - version?: number - view_count?: number | null - viewed_at?: string | null } Relationships: [ { - foreignKeyName: "quotes_organization_id_fkey" - columns: ["organization_id"] - isOneToOne: false - referencedRelation: "organizations" - referencedColumns: ["id"] - }, - { - foreignKeyName: "quotes_parent_quote_id_fkey" - columns: ["parent_quote_id"] + foreignKeyName: "kit_variants_kit_master_id_fkey" + columns: ["kit_master_id"] isOneToOne: false - referencedRelation: "quotes" + referencedRelation: "custom_kits" referencedColumns: ["id"] }, ] } - recently_viewed_products: { + login_attempts: { Row: { + created_at: string + email: string | null + failure_reason: string | null id: string - product_id: string - user_id: string - viewed_at: string + ip_address: string + metadata: Json | null + success: boolean + user_agent: string | null + user_id: string | null } Insert: { + created_at?: string + email?: string | null + failure_reason?: string | null id?: string - product_id: string - user_id: string - viewed_at?: string + ip_address: string + metadata?: Json | null + success: boolean + user_agent?: string | null + user_id?: string | null } Update: { + created_at?: string + email?: string | null + failure_reason?: string | null id?: string - product_id?: string - user_id?: string - viewed_at?: string + ip_address?: string + metadata?: Json | null + success?: boolean + user_agent?: string | null + user_id?: string | null } Relationships: [] } - request_rate_limits: { + magic_up_brand_kits: { Row: { - blocked_until: string | null + client_id: string | null + client_name: string | null created_at: string - endpoint: string + forbidden_words: string[] id: string - identifier: string - request_count: number + logo_urls: Json + metadata: Json + notes: string | null + primary_color: string | null + required_words: string[] + secondary_color: string | null + tone_of_voice: string | null updated_at: string - window_start: string + user_id: string + visual_style: string | null } Insert: { - blocked_until?: string | null + client_id?: string | null + client_name?: string | null created_at?: string - endpoint: string + forbidden_words?: string[] id?: string - identifier: string - request_count?: number + logo_urls?: Json + metadata?: Json + notes?: string | null + primary_color?: string | null + required_words?: string[] + secondary_color?: string | null + tone_of_voice?: string | null updated_at?: string - window_start?: string + user_id: string + visual_style?: string | null } Update: { - blocked_until?: string | null + client_id?: string | null + client_name?: string | null created_at?: string - endpoint?: string + forbidden_words?: string[] id?: string - identifier?: string - request_count?: number + logo_urls?: Json + metadata?: Json + notes?: string | null + primary_color?: string | null + required_words?: string[] + secondary_color?: string | null + tone_of_voice?: string | null updated_at?: string - window_start?: string + user_id?: string + visual_style?: string | null } Relationships: [] } - rls_denial_log: { + magic_up_campaigns: { Row: { + audience: string | null + channel: string | null + client_id: string | null + client_name: string | null created_at: string - endpoint: string | null - error_code: string | null - error_message: string | null + cta: string | null id: string - ip_address: unknown - operation: string - policy_hint: string | null - query_summary: string | null - table_name: string - target_id: string | null - target_seller_id: string | null - user_agent: string | null - user_email: string | null - user_id: string - user_role: string | null - } - Insert: { + metadata: Json + objective: string | null + occasion: string | null + status: string + title: string + tone: string | null + updated_at: string + user_id: string + } + Insert: { + audience?: string | null + channel?: string | null + client_id?: string | null + client_name?: string | null created_at?: string - endpoint?: string | null - error_code?: string | null - error_message?: string | null + cta?: string | null id?: string - ip_address?: unknown - operation: string - policy_hint?: string | null - query_summary?: string | null - table_name: string - target_id?: string | null - target_seller_id?: string | null - user_agent?: string | null - user_email?: string | null + metadata?: Json + objective?: string | null + occasion?: string | null + status?: string + title?: string + tone?: string | null + updated_at?: string user_id: string - user_role?: string | null } Update: { + audience?: string | null + channel?: string | null + client_id?: string | null + client_name?: string | null created_at?: string - endpoint?: string | null - error_code?: string | null - error_message?: string | null + cta?: string | null id?: string - ip_address?: unknown - operation?: string - policy_hint?: string | null - query_summary?: string | null - table_name?: string - target_id?: string | null - target_seller_id?: string | null - user_agent?: string | null - user_email?: string | null + metadata?: Json + objective?: string | null + occasion?: string | null + status?: string + title?: string + tone?: string | null + updated_at?: string user_id?: string - user_role?: string | null } Relationships: [] } - role_migration_batches: { + magic_up_comments: { Row: { + author_name: string + comment: string created_at: string - dry_run: boolean - duration_ms: number | null - failed_count: number - finished_at: string | null + generation_id: string id: string - initiated_by: string - label: string - reason: string - skipped_count: number - started_at: string | null - status: Database["public"]["Enums"]["role_migration_status"] - success_count: number - total_items: number + is_public: boolean + user_id: string } Insert: { + author_name?: string + comment: string created_at?: string - dry_run?: boolean - duration_ms?: number | null - failed_count?: number - finished_at?: string | null + generation_id: string id?: string - initiated_by: string - label: string - reason: string - skipped_count?: number - started_at?: string | null - status?: Database["public"]["Enums"]["role_migration_status"] - success_count?: number - total_items?: number + is_public?: boolean + user_id: string } Update: { + author_name?: string + comment?: string created_at?: string - dry_run?: boolean - duration_ms?: number | null - failed_count?: number - finished_at?: string | null + generation_id?: string id?: string - initiated_by?: string - label?: string - reason?: string - skipped_count?: number - started_at?: string | null - status?: Database["public"]["Enums"]["role_migration_status"] - success_count?: number - total_items?: number + is_public?: boolean + user_id?: string } Relationships: [] } - role_migration_items: { + magic_up_generations: { Row: { - batch_id: string + aspect_ratio: string | null + campaign_id: string | null + channel: string | null + client_name: string | null + copy_pack: Json created_at: string - duration_ms: number | null - error_message: string | null - from_role: Database["public"]["Enums"]["app_role"] | null + export_presets: Json + generated_image_url: string | null id: string - operation: string - processed_at: string | null - status: Database["public"]["Enums"]["role_migration_item_status"] - to_role: Database["public"]["Enums"]["app_role"] - user_email: string | null + is_favorite: boolean | null + metadata: Json + model: string | null + product_id: string | null + product_name: string | null + product_sku: string | null + prompt_text: string | null + quality_score: number | null + scene_category: string | null + scene_title: string | null + status: string + tags: string[] user_id: string } Insert: { - batch_id: string + aspect_ratio?: string | null + campaign_id?: string | null + channel?: string | null + client_name?: string | null + copy_pack?: Json created_at?: string - duration_ms?: number | null - error_message?: string | null - from_role?: Database["public"]["Enums"]["app_role"] | null + export_presets?: Json + generated_image_url?: string | null id?: string - operation: string - processed_at?: string | null - status?: Database["public"]["Enums"]["role_migration_item_status"] - to_role: Database["public"]["Enums"]["app_role"] - user_email?: string | null + is_favorite?: boolean | null + metadata?: Json + model?: string | null + product_id?: string | null + product_name?: string | null + product_sku?: string | null + prompt_text?: string | null + quality_score?: number | null + scene_category?: string | null + scene_title?: string | null + status?: string + tags?: string[] user_id: string } Update: { - batch_id?: string + aspect_ratio?: string | null + campaign_id?: string | null + channel?: string | null + client_name?: string | null + copy_pack?: Json created_at?: string - duration_ms?: number | null - error_message?: string | null - from_role?: Database["public"]["Enums"]["app_role"] | null + export_presets?: Json + generated_image_url?: string | null id?: string - operation?: string - processed_at?: string | null - status?: Database["public"]["Enums"]["role_migration_item_status"] - to_role?: Database["public"]["Enums"]["app_role"] - user_email?: string | null + is_favorite?: boolean | null + metadata?: Json + model?: string | null + product_id?: string | null + product_name?: string | null + product_sku?: string | null + prompt_text?: string | null + quality_score?: number | null + scene_category?: string | null + scene_title?: string | null + status?: string + tags?: string[] user_id?: string } - Relationships: [ - { - foreignKeyName: "role_migration_items_batch_id_fkey" - columns: ["batch_id"] - isOneToOne: false - referencedRelation: "role_migration_batches" - referencedColumns: ["id"] - }, - ] + Relationships: [] } - role_permissions: { + magic_up_public_shares: { Row: { + allow_comments: boolean + allow_download: boolean + campaign_id: string | null created_at: string + expires_at: string | null + generation_id: string | null id: string - permission_code: string - role: Database["public"]["Enums"]["app_role"] + metadata: Json + share_token: string + status: string + updated_at: string + user_id: string } Insert: { + allow_comments?: boolean + allow_download?: boolean + campaign_id?: string | null created_at?: string + expires_at?: string | null + generation_id?: string | null id?: string - permission_code: string - role: Database["public"]["Enums"]["app_role"] + metadata?: Json + share_token?: string + status?: string + updated_at?: string + user_id: string } Update: { + allow_comments?: boolean + allow_download?: boolean + campaign_id?: string | null created_at?: string + expires_at?: string | null + generation_id?: string | null id?: string - permission_code?: string - role?: Database["public"]["Enums"]["app_role"] + metadata?: Json + share_token?: string + status?: string + updated_at?: string + user_id?: string } Relationships: [] } - saved_filters: { + magic_up_reactions: { Row: { - category: string - color: string | null created_at: string - description: string | null - filter_config: Json - icon: string | null + generation_id: string id: string - is_default: boolean - name: string - updated_at: string - user_id: string + ip_hash: string | null + reaction_type: string + user_agent: string | null + user_id: string } Insert: { - category?: string - color?: string | null created_at?: string - description?: string | null - filter_config?: Json - icon?: string | null + generation_id: string id?: string - is_default?: boolean - name: string - updated_at?: string + ip_hash?: string | null + reaction_type: string + user_agent?: string | null user_id: string } Update: { - category?: string - color?: string | null created_at?: string - description?: string | null - filter_config?: Json - icon?: string | null + generation_id?: string id?: string - is_default?: boolean - name?: string - updated_at?: string + ip_hash?: string | null + reaction_type?: string + user_agent?: string | null user_id?: string } Relationships: [] } - saved_trends_views: { + markup_configurations: { Row: { - created_at: string - filters: Json + category_id: string | null + created_at: string | null + created_by: string | null + description: string | null id: string - name: string - updated_at: string - user_id: string + is_active: boolean | null + markup_percent: number + organization_id: string | null + priority: number | null + product_id: string | null + supplier_id: string | null + updated_at: string | null + variant_id: string | null } Insert: { - created_at?: string - filters?: Json + category_id?: string | null + created_at?: string | null + created_by?: string | null + description?: string | null id?: string - name: string - updated_at?: string - user_id: string + is_active?: boolean | null + markup_percent: number + organization_id?: string | null + priority?: number | null + product_id?: string | null + supplier_id?: string | null + updated_at?: string | null + variant_id?: string | null } Update: { - created_at?: string - filters?: Json + category_id?: string | null + created_at?: string | null + created_by?: string | null + description?: string | null id?: string - name?: string - updated_at?: string - user_id?: string + is_active?: boolean | null + markup_percent?: number + organization_id?: string | null + priority?: number | null + product_id?: string | null + supplier_id?: string | null + updated_at?: string | null + variant_id?: string | null } - Relationships: [] + Relationships: [ + { + foreignKeyName: "markup_configurations_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "markup_configurations_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "markup_configurations_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "markup_configurations_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "markup_configurations_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "markup_configurations_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "markup_configurations_created_by_fkey" + columns: ["created_by"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + }, + { + foreignKeyName: "markup_configurations_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "markup_configurations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "markup_configurations_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "markup_configurations_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "markup_configurations_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "markup_configurations_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "markup_configurations_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "product_variants" + referencedColumns: ["id"] + }, + { + foreignKeyName: "markup_configurations_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "markup_configurations_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "markup_configurations_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_variant_sale_prices" + referencedColumns: ["variant_id"] + }, + ] } - scheduled_reports: { + material_equivalences: { Row: { - created_at: string - email_to: string - filters: Json | null - frequency: string + confidence_score: number | null + created_at: string | null id: string - is_active: boolean - last_sent_at: string | null - next_run_at: string - report_name: string - report_type: string - updated_at: string - user_id: string + match_level: string + match_quality: string | null + notes: string | null + promo_group_id: string | null + promo_type_id: string | null + promo_variation_id: string | null + supplier_material_id: string + updated_at: string | null } Insert: { - created_at?: string - email_to: string - filters?: Json | null - frequency?: string + confidence_score?: number | null + created_at?: string | null id?: string - is_active?: boolean - last_sent_at?: string | null - next_run_at?: string - report_name?: string - report_type?: string - updated_at?: string - user_id: string + match_level?: string + match_quality?: string | null + notes?: string | null + promo_group_id?: string | null + promo_type_id?: string | null + promo_variation_id?: string | null + supplier_material_id: string + updated_at?: string | null } Update: { - created_at?: string - email_to?: string - filters?: Json | null - frequency?: string + confidence_score?: number | null + created_at?: string | null id?: string - is_active?: boolean - last_sent_at?: string | null - next_run_at?: string - report_name?: string - report_type?: string - updated_at?: string - user_id?: string + match_level?: string + match_quality?: string | null + notes?: string | null + promo_group_id?: string | null + promo_type_id?: string | null + promo_variation_id?: string | null + supplier_material_id?: string + updated_at?: string | null } - Relationships: [] + Relationships: [ + { + foreignKeyName: "material_equivalences_promo_group_id_fkey" + columns: ["promo_group_id"] + isOneToOne: false + referencedRelation: "material_groups" + referencedColumns: ["id"] + }, + { + foreignKeyName: "material_equivalences_promo_group_id_fkey" + columns: ["promo_group_id"] + isOneToOne: false + referencedRelation: "materials_complete" + referencedColumns: ["group_id"] + }, + { + foreignKeyName: "material_equivalences_promo_type_id_fkey" + columns: ["promo_type_id"] + isOneToOne: false + referencedRelation: "material_types" + referencedColumns: ["id"] + }, + { + foreignKeyName: "material_equivalences_promo_type_id_fkey" + columns: ["promo_type_id"] + isOneToOne: false + referencedRelation: "materials_complete" + referencedColumns: ["material_id"] + }, + { + foreignKeyName: "material_equivalences_promo_type_id_fkey" + columns: ["promo_type_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["material_id"] + }, + { + foreignKeyName: "material_equivalences_promo_variation_id_fkey" + columns: ["promo_variation_id"] + isOneToOne: false + referencedRelation: "material_variations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "material_equivalences_supplier_material_id_fkey" + columns: ["supplier_material_id"] + isOneToOne: true + referencedRelation: "supplier_materials" + referencedColumns: ["id"] + }, + ] } - search_analytics: { + material_groups: { Row: { - created_at: string + created_at: string | null + created_by: string | null + description: string | null id: string - results_count: number - search_context: string | null - search_term: string - user_id: string | null + is_active: boolean | null + name: string + organization_id: string + slug: string + sort_order: number | null + updated_at: string | null + updated_by: string | null } Insert: { - created_at?: string + created_at?: string | null + created_by?: string | null + description?: string | null id?: string - results_count?: number - search_context?: string | null - search_term: string - user_id?: string | null + is_active?: boolean | null + name: string + organization_id: string + slug: string + sort_order?: number | null + updated_at?: string | null + updated_by?: string | null } Update: { - created_at?: string + created_at?: string | null + created_by?: string | null + description?: string | null id?: string - results_count?: number - search_context?: string | null - search_term?: string - user_id?: string | null + is_active?: boolean | null + name?: string + organization_id?: string + slug?: string + sort_order?: number | null + updated_at?: string | null + updated_by?: string | null } Relationships: [] } - secret_rotation_log: { + material_types: { Row: { - action_type: string + created_at: string | null + description: string | null + display_order: number | null + group_id: string id: string - new_suffix: string | null - notes: string | null - previous_suffix: string | null - rotated_at: string - rotated_by: string - secret_name: string + is_active: boolean | null + name: string + organization_id: string + properties: Json | null + slug: string + updated_at: string | null } Insert: { - action_type?: string + created_at?: string | null + description?: string | null + display_order?: number | null + group_id: string id?: string - new_suffix?: string | null - notes?: string | null - previous_suffix?: string | null - rotated_at?: string - rotated_by: string - secret_name: string + is_active?: boolean | null + name: string + organization_id: string + properties?: Json | null + slug: string + updated_at?: string | null } Update: { - action_type?: string + created_at?: string | null + description?: string | null + display_order?: number | null + group_id?: string id?: string - new_suffix?: string | null - notes?: string | null - previous_suffix?: string | null - rotated_at?: string - rotated_by?: string - secret_name?: string + is_active?: boolean | null + name?: string + organization_id?: string + properties?: Json | null + slug?: string + updated_at?: string | null } - Relationships: [] + Relationships: [ + { + foreignKeyName: "material_types_group_id_fkey" + columns: ["group_id"] + isOneToOne: false + referencedRelation: "material_groups" + referencedColumns: ["id"] + }, + { + foreignKeyName: "material_types_group_id_fkey" + columns: ["group_id"] + isOneToOne: false + referencedRelation: "materials_complete" + referencedColumns: ["group_id"] + }, + { + foreignKeyName: "material_types_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + ] } - seller_cart_items: { + material_variations: { Row: { - cart_id: string - color_hex: string | null - color_name: string | null - created_at: string + created_at: string | null + description: string | null + display_order: number | null id: string - notes: string | null - product_id: string - product_image_url: string | null - product_name: string - product_price: number - product_sku: string | null - quantity: number - sort_order: number | null - updated_at: string + is_active: boolean | null + name: string + organization_id: string + slug: string + specifications: Json | null + type_id: string + updated_at: string | null } Insert: { - cart_id: string - color_hex?: string | null - color_name?: string | null - created_at?: string + created_at?: string | null + description?: string | null + display_order?: number | null id?: string - notes?: string | null - product_id: string - product_image_url?: string | null - product_name: string - product_price?: number - product_sku?: string | null - quantity?: number - sort_order?: number | null - updated_at?: string + is_active?: boolean | null + name: string + organization_id: string + slug: string + specifications?: Json | null + type_id: string + updated_at?: string | null } Update: { - cart_id?: string - color_hex?: string | null - color_name?: string | null - created_at?: string + created_at?: string | null + description?: string | null + display_order?: number | null id?: string - notes?: string | null - product_id?: string - product_image_url?: string | null - product_name?: string - product_price?: number - product_sku?: string | null - quantity?: number - sort_order?: number | null - updated_at?: string + is_active?: boolean | null + name?: string + organization_id?: string + slug?: string + specifications?: Json | null + type_id?: string + updated_at?: string | null } Relationships: [ { - foreignKeyName: "seller_cart_items_cart_id_fkey" - columns: ["cart_id"] + foreignKeyName: "material_variations_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "material_variations_type_id_fkey" + columns: ["type_id"] isOneToOne: false - referencedRelation: "seller_carts" + referencedRelation: "material_types" referencedColumns: ["id"] }, + { + foreignKeyName: "material_variations_type_id_fkey" + columns: ["type_id"] + isOneToOne: false + referencedRelation: "materials_complete" + referencedColumns: ["material_id"] + }, + { + foreignKeyName: "material_variations_type_id_fkey" + columns: ["type_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["material_id"] + }, ] } - seller_carts: { + mcp_access_violations: { Row: { - company_id: string - company_location: string | null - company_logo_url: string | null - company_name: string created_at: string + details: Json id: string - notes: string | null - seller_id: string - status: string - updated_at: string + ip_address: string | null + operation: string | null + reason: string + request_id: string | null + source: string + target_key_id: string | null + user_agent: string | null + user_id: string | null } Insert: { - company_id: string - company_location?: string | null - company_logo_url?: string | null - company_name: string created_at?: string + details?: Json id?: string - notes?: string | null - seller_id: string - status?: string - updated_at?: string + ip_address?: string | null + operation?: string | null + reason: string + request_id?: string | null + source: string + target_key_id?: string | null + user_agent?: string | null + user_id?: string | null } Update: { - company_id?: string - company_location?: string | null - company_logo_url?: string | null - company_name?: string created_at?: string + details?: Json id?: string - notes?: string | null - seller_id?: string - status?: string - updated_at?: string + ip_address?: string | null + operation?: string | null + reason?: string + request_id?: string | null + source?: string + target_key_id?: string | null + user_agent?: string | null + user_id?: string | null } Relationships: [] } - seller_discount_limits: { + mcp_api_keys: { Row: { - approval_required_above: number | null created_at: string + created_by: string + description: string | null + expires_at: string | null id: string - max_discount_percent: number - notes: string | null - set_by: string + key_hash: string + key_prefix: string + last_used_at: string | null + name: string + revoked_at: string | null + rotated_from: string | null + scopes: string[] updated_at: string - user_id: string } Insert: { - approval_required_above?: number | null created_at?: string + created_by: string + description?: string | null + expires_at?: string | null id?: string - max_discount_percent?: number - notes?: string | null - set_by: string + key_hash: string + key_prefix: string + last_used_at?: string | null + name: string + revoked_at?: string | null + rotated_from?: string | null + scopes?: string[] updated_at?: string - user_id: string } Update: { - approval_required_above?: number | null created_at?: string + created_by?: string + description?: string | null + expires_at?: string | null id?: string - max_discount_percent?: number - notes?: string | null - set_by?: string + key_hash?: string + key_prefix?: string + last_used_at?: string | null + name?: string + revoked_at?: string | null + rotated_from?: string | null + scopes?: string[] updated_at?: string + } + Relationships: [ + { + foreignKeyName: "mcp_api_keys_rotated_from_fkey" + columns: ["rotated_from"] + isOneToOne: false + referencedRelation: "mcp_api_keys" + referencedColumns: ["id"] + }, + ] + } + mcp_full_grantors: { + Row: { + granted_at: string + granted_by: string | null + reason: string | null + user_id: string + } + Insert: { + granted_at?: string + granted_by?: string | null + reason?: string | null + user_id: string + } + Update: { + granted_at?: string + granted_by?: string | null + reason?: string | null user_id?: string } Relationships: [] } - simulation_logs: { + mcp_key_auto_revocations: { Row: { - created_at: string | null - error_message: string | null - fn_name: string + created_at: string + created_by: string id: string - latency_ms: number | null - payload: Json | null - run_id: string | null - status_code: number | null + key_id: string + reason: string + revoked_at: string + source: string } Insert: { - created_at?: string | null - error_message?: string | null - fn_name: string + created_at?: string + created_by: string id?: string - latency_ms?: number | null - payload?: Json | null - run_id?: string | null - status_code?: number | null + key_id: string + reason?: string + revoked_at?: string + source: string } Update: { - created_at?: string | null - error_message?: string | null - fn_name?: string + created_at?: string + created_by?: string id?: string - latency_ms?: number | null - payload?: Json | null - run_id?: string | null - status_code?: number | null + key_id?: string + reason?: string + revoked_at?: string + source?: string } Relationships: [ { - foreignKeyName: "simulation_logs_run_id_fkey" - columns: ["run_id"] + foreignKeyName: "mcp_key_auto_revocations_key_id_fkey" + columns: ["key_id"] isOneToOne: false - referencedRelation: "simulation_runs" + referencedRelation: "mcp_api_keys" referencedColumns: ["id"] }, ] } - simulation_runs: { + media_assets: { Row: { - avg_latency_ms: number | null + alt_text: string | null + cdn_url: string | null + cloudflare_id: string | null created_at: string | null - failures: number | null + display_order: number | null + error_message: string | null + file_size: number | null + filename: string | null + height: number | null id: string - metadata: Json | null - mode: string - p50_latency_ms: number | null - p90_latency_ms: number | null - p99_latency_ms: number | null - status: string - successes: number | null - total_scenarios: number | null + image_role: string | null + image_type: string + is_primary: boolean | null + is_visible: boolean | null + mime_type: string | null + original_filename: string | null + processed_at: string | null + product_reference: string + retry_count: number | null + source_url: string | null + status: string | null + supplier_code: string | null + updated_at: string | null + variant_sku: string | null + width: number | null } Insert: { - avg_latency_ms?: number | null + alt_text?: string | null + cdn_url?: string | null + cloudflare_id?: string | null created_at?: string | null - failures?: number | null + display_order?: number | null + error_message?: string | null + file_size?: number | null + filename?: string | null + height?: number | null id?: string - metadata?: Json | null - mode: string - p50_latency_ms?: number | null - p90_latency_ms?: number | null - p99_latency_ms?: number | null - status?: string - successes?: number | null - total_scenarios?: number | null + image_role?: string | null + image_type?: string + is_primary?: boolean | null + is_visible?: boolean | null + mime_type?: string | null + original_filename?: string | null + processed_at?: string | null + product_reference: string + retry_count?: number | null + source_url?: string | null + status?: string | null + supplier_code?: string | null + updated_at?: string | null + variant_sku?: string | null + width?: number | null } Update: { - avg_latency_ms?: number | null + alt_text?: string | null + cdn_url?: string | null + cloudflare_id?: string | null created_at?: string | null - failures?: number | null - id?: string - metadata?: Json | null - mode?: string - p50_latency_ms?: number | null - p90_latency_ms?: number | null - p99_latency_ms?: number | null - status?: string - successes?: number | null - total_scenarios?: number | null - } - Relationships: [] - } - simulator_wizard_drafts: { - Row: { - created_at: string - id: string - personalizations: Json - product_data: Json - quantity: number - title: string - updated_at: string - user_id: string - wizard_step: string - } - Insert: { - created_at?: string - id?: string - personalizations?: Json - product_data?: Json - quantity?: number - title?: string - updated_at?: string - user_id: string - wizard_step?: string - } - Update: { - created_at?: string + display_order?: number | null + error_message?: string | null + file_size?: number | null + filename?: string | null + height?: number | null id?: string - personalizations?: Json - product_data?: Json - quantity?: number - title?: string - updated_at?: string - user_id?: string - wizard_step?: string + image_role?: string | null + image_type?: string + is_primary?: boolean | null + is_visible?: boolean | null + mime_type?: string | null + original_filename?: string | null + processed_at?: string | null + product_reference?: string + retry_count?: number | null + source_url?: string | null + status?: string | null + supplier_code?: string | null + updated_at?: string | null + variant_sku?: string | null + width?: number | null } Relationships: [] } - step_up_audit_log: { + media_sync_log: { Row: { - action: Database["public"]["Enums"]["step_up_action"] | null - challenge_id: string | null - created_at: string - event_type: string + cloudflare_id: string | null + created_at: string | null + destination_url: string | null + error_message: string | null + file_size_bytes: number | null id: string - ip_address: unknown + image_id: string | null + media_type: string metadata: Json | null - target_ref: string | null - token_id: string | null - user_agent: string | null - user_id: string | null + processing_time_ms: number | null + product_id: string | null + retry_count: number | null + source_url: string | null + status: string + sync_type: string + synced_by: string | null + video_id: string | null } Insert: { - action?: Database["public"]["Enums"]["step_up_action"] | null - challenge_id?: string | null - created_at?: string - event_type: string + cloudflare_id?: string | null + created_at?: string | null + destination_url?: string | null + error_message?: string | null + file_size_bytes?: number | null id?: string - ip_address?: unknown + image_id?: string | null + media_type: string metadata?: Json | null - target_ref?: string | null - token_id?: string | null - user_agent?: string | null - user_id?: string | null + processing_time_ms?: number | null + product_id?: string | null + retry_count?: number | null + source_url?: string | null + status?: string + sync_type: string + synced_by?: string | null + video_id?: string | null } Update: { - action?: Database["public"]["Enums"]["step_up_action"] | null - challenge_id?: string | null - created_at?: string - event_type?: string + cloudflare_id?: string | null + created_at?: string | null + destination_url?: string | null + error_message?: string | null + file_size_bytes?: number | null id?: string - ip_address?: unknown + image_id?: string | null + media_type?: string metadata?: Json | null - target_ref?: string | null - token_id?: string | null - user_agent?: string | null - user_id?: string | null - } - Relationships: [] - } - step_up_challenges: { - Row: { - action: Database["public"]["Enums"]["step_up_action"] - attempts: number - consumed: boolean - created_at: string - expires_at: string - id: string - ip_address: unknown - max_attempts: number - otp_hash: string - otp_verified: boolean - password_verified: boolean - target_ref: string | null - user_agent: string | null - user_id: string + processing_time_ms?: number | null + product_id?: string | null + retry_count?: number | null + source_url?: string | null + status?: string + sync_type?: string + synced_by?: string | null + video_id?: string | null } - Insert: { - action: Database["public"]["Enums"]["step_up_action"] - attempts?: number - consumed?: boolean - created_at?: string - expires_at?: string - id?: string - ip_address?: unknown - max_attempts?: number - otp_hash: string - otp_verified?: boolean - password_verified?: boolean - target_ref?: string | null - user_agent?: string | null - user_id: string - } - Update: { - action?: Database["public"]["Enums"]["step_up_action"] - attempts?: number - consumed?: boolean - created_at?: string - expires_at?: string - id?: string - ip_address?: unknown - max_attempts?: number - otp_hash?: string - otp_verified?: boolean - password_verified?: boolean - target_ref?: string | null - user_agent?: string | null - user_id?: string - } - Relationships: [] + Relationships: [ + { + foreignKeyName: "media_sync_log_image_id_fkey" + columns: ["image_id"] + isOneToOne: false + referencedRelation: "product_images" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_image_id_fkey" + columns: ["image_id"] + isOneToOne: false + referencedRelation: "v_images_below_requirements" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_image_id_fkey" + columns: ["image_id"] + isOneToOne: false + referencedRelation: "v_media_combined" + referencedColumns: ["product_image_id"] + }, + { + foreignKeyName: "media_sync_log_image_id_fkey" + columns: ["image_id"] + isOneToOne: false + referencedRelation: "v_product_images_cdn" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_video_id_fkey" + columns: ["video_id"] + isOneToOne: false + referencedRelation: "product_videos" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_video_id_fkey" + columns: ["video_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_video_id_fkey" + columns: ["video_id"] + isOneToOne: false + referencedRelation: "v_videos_pending" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_video_id_fkey" + columns: ["video_id"] + isOneToOne: false + referencedRelation: "v_videos_with_urls" + referencedColumns: ["id"] + }, + ] } - step_up_tokens: { + media_sync_queue: { Row: { - action: Database["public"]["Enums"]["step_up_action"] - challenge_id: string - consumed: boolean - consumed_at: string | null - created_at: string - expires_at: string + attempts: number + cloudflare_image_id: string | null + cloudflare_url: string | null + completed_at: string | null + error_message: string | null id: string - target_ref: string | null - token_hash: string - user_id: string + max_attempts: number + organization_id: string | null + priority: number + product_id: string + queued_at: string + source_type: string | null + source_url: string | null + started_at: string | null + status: string + supplier_id: string | null } Insert: { - action: Database["public"]["Enums"]["step_up_action"] - challenge_id: string - consumed?: boolean - consumed_at?: string | null - created_at?: string - expires_at?: string + attempts?: number + cloudflare_image_id?: string | null + cloudflare_url?: string | null + completed_at?: string | null + error_message?: string | null id?: string - target_ref?: string | null - token_hash: string - user_id: string + max_attempts?: number + organization_id?: string | null + priority?: number + product_id: string + queued_at?: string + source_type?: string | null + source_url?: string | null + started_at?: string | null + status?: string + supplier_id?: string | null } Update: { - action?: Database["public"]["Enums"]["step_up_action"] - challenge_id?: string - consumed?: boolean - consumed_at?: string | null - created_at?: string - expires_at?: string + attempts?: number + cloudflare_image_id?: string | null + cloudflare_url?: string | null + completed_at?: string | null + error_message?: string | null id?: string - target_ref?: string | null - token_hash?: string - user_id?: string + max_attempts?: number + organization_id?: string | null + priority?: number + product_id?: string + queued_at?: string + source_type?: string | null + source_url?: string | null + started_at?: string | null + status?: string + supplier_id?: string | null } Relationships: [ { - foreignKeyName: "step_up_tokens_challenge_id_fkey" - columns: ["challenge_id"] + foreignKeyName: "media_sync_queue_organization_id_fkey" + columns: ["organization_id"] isOneToOne: false - referencedRelation: "step_up_challenges" + referencedRelation: "organizations" referencedColumns: ["id"] }, - ] - } - system_settings: { - Row: { - description: string | null - key: string - updated_at: string - updated_by: string | null - value: Json - } - Insert: { - description?: string | null - key: string - updated_at?: string - updated_by?: string | null - value: Json - } - Update: { - description?: string | null - key?: string - updated_at?: string - updated_by?: string | null - value?: Json - } - Relationships: [] - } - user_comparisons: { - Row: { - client_id: string | null - client_name: string | null - created_at: string - id: string - is_public: boolean - items: Json - name: string | null - share_expires_at: string | null - share_token: string | null - updated_at: string - user_id: string - view_count: number + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_queue_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_queue_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_queue_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "media_sync_queue_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "media_sync_queue_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + mockup_approval_links: { + Row: { + access_count: number | null + approved_at: string | null + client_id: string | null + client_notes: string | null + created_at: string + current_uses: number | null + expires_at: string | null + first_accessed_at: string | null + id: string + is_active: boolean | null + job_id: string + last_accessed_at: string | null + max_uses: number | null + public_token: string + rejected_at: string | null + updated_at: string } Insert: { + access_count?: number | null + approved_at?: string | null client_id?: string | null - client_name?: string | null + client_notes?: string | null created_at?: string + current_uses?: number | null + expires_at?: string | null + first_accessed_at?: string | null id?: string - is_public?: boolean - items?: Json - name?: string | null - share_expires_at?: string | null - share_token?: string | null + is_active?: boolean | null + job_id: string + last_accessed_at?: string | null + max_uses?: number | null + public_token: string + rejected_at?: string | null updated_at?: string - user_id: string - view_count?: number } Update: { + access_count?: number | null + approved_at?: string | null client_id?: string | null - client_name?: string | null + client_notes?: string | null created_at?: string + current_uses?: number | null + expires_at?: string | null + first_accessed_at?: string | null id?: string - is_public?: boolean - items?: Json - name?: string | null - share_expires_at?: string | null - share_token?: string | null + is_active?: boolean | null + job_id?: string + last_accessed_at?: string | null + max_uses?: number | null + public_token?: string + rejected_at?: string | null updated_at?: string - user_id?: string - view_count?: number } - Relationships: [] + Relationships: [ + { + foreignKeyName: "mockup_approval_links_job_id_fkey" + columns: ["job_id"] + isOneToOne: false + referencedRelation: "mockup_generation_jobs" + referencedColumns: ["id"] + }, + ] } - user_known_devices: { + mockup_credit_transactions: { Row: { + amount: number + balance_after: number + balance_before: number created_at: string - device_name: string | null - fingerprint: string + credit_account_id: string + description: string | null id: string - last_seen_at: string + job_id: string | null + metadata: Json | null + mockup_id: string | null + type: string user_id: string } Insert: { + amount: number + balance_after: number + balance_before: number created_at?: string - device_name?: string | null - fingerprint: string + credit_account_id: string + description?: string | null id?: string - last_seen_at?: string + job_id?: string | null + metadata?: Json | null + mockup_id?: string | null + type: string user_id: string } Update: { + amount?: number + balance_after?: number + balance_before?: number created_at?: string - device_name?: string | null - fingerprint?: string + credit_account_id?: string + description?: string | null id?: string - last_seen_at?: string + job_id?: string | null + metadata?: Json | null + mockup_id?: string | null + type?: string user_id?: string } - Relationships: [] + Relationships: [ + { + foreignKeyName: "mockup_credit_transactions_credit_account_id_fkey" + columns: ["credit_account_id"] + isOneToOne: false + referencedRelation: "mockup_credits" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_credit_transactions_job_id_fkey" + columns: ["job_id"] + isOneToOne: false + referencedRelation: "mockup_generation_jobs" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_credit_transactions_mockup_id_fkey" + columns: ["mockup_id"] + isOneToOne: false + referencedRelation: "generated_mockups" + referencedColumns: ["id"] + }, + ] } - user_onboarding: { + mockup_credits: { Row: { - completed_at: string | null - completed_steps: Json | null + balance: number created_at: string - current_step: number - has_completed_tour: boolean + current_day_spent: number | null + current_month_spent: number | null + daily_limit: number | null id: string - started_at: string | null + last_reset_day: string | null + last_reset_month: string | null + lifetime_earned: number + lifetime_spent: number + monthly_limit: number | null updated_at: string user_id: string } Insert: { - completed_at?: string | null - completed_steps?: Json | null + balance?: number created_at?: string - current_step?: number - has_completed_tour?: boolean - id?: string - started_at?: string | null + current_day_spent?: number | null + current_month_spent?: number | null + daily_limit?: number | null + id?: string + last_reset_day?: string | null + last_reset_month?: string | null + lifetime_earned?: number + lifetime_spent?: number + monthly_limit?: number | null updated_at?: string user_id: string } Update: { - completed_at?: string | null - completed_steps?: Json | null + balance?: number created_at?: string - current_step?: number - has_completed_tour?: boolean - id?: string - started_at?: string | null + current_day_spent?: number | null + current_month_spent?: number | null + daily_limit?: number | null + id?: string + last_reset_day?: string | null + last_reset_month?: string | null + lifetime_earned?: number + lifetime_spent?: number + monthly_limit?: number | null updated_at?: string user_id?: string } Relationships: [] } - user_preferences: { + mockup_drafts: { Row: { - comparison_column_order: Json - comparison_weights: Json + client_id: string | null + client_name: string | null created_at: string - filter_states: Json + draft_key: string id: string + logo_data: string | null + personalization_areas: Json | null + product_id: string | null + product_name: string | null + technique_id: string | null + technique_name: string | null updated_at: string user_id: string } Insert: { - comparison_column_order?: Json - comparison_weights?: Json + client_id?: string | null + client_name?: string | null created_at?: string - filter_states?: Json + draft_key?: string id?: string + logo_data?: string | null + personalization_areas?: Json | null + product_id?: string | null + product_name?: string | null + technique_id?: string | null + technique_name?: string | null updated_at?: string user_id: string } Update: { - comparison_column_order?: Json - comparison_weights?: Json + client_id?: string | null + client_name?: string | null created_at?: string - filter_states?: Json + draft_key?: string id?: string + logo_data?: string | null + personalization_areas?: Json | null + product_id?: string | null + product_name?: string | null + technique_id?: string | null + technique_name?: string | null updated_at?: string user_id?: string } Relationships: [] } - user_roles: { + mockup_generation_jobs: { Row: { + actual_cost: number | null + ai_model: string | null + areas_config: Json + art_colors_count: number | null + client_id: string | null + colors_count: number + completed_mockups: number | null created_at: string - granted_by: string | null - role: Database["public"]["Enums"]["app_role"] + custom_prompt: string | null + error_message: string | null + estimated_cost: number | null + failed_mockups: number | null + id: string + logo_filename: string | null + logo_url: string + processing_completed_at: string | null + processing_started_at: string | null + product_colors: Json + product_id: string | null + product_name: string + product_sku: string | null + status: string + technique_id: string | null + technique_name: string + total_mockups: number + updated_at: string user_id: string } Insert: { + actual_cost?: number | null + ai_model?: string | null + areas_config?: Json + art_colors_count?: number | null + client_id?: string | null + colors_count?: number + completed_mockups?: number | null created_at?: string - granted_by?: string | null - role?: Database["public"]["Enums"]["app_role"] - user_id: string + custom_prompt?: string | null + error_message?: string | null + estimated_cost?: number | null + failed_mockups?: number | null + id?: string + logo_filename?: string | null + logo_url: string + processing_completed_at?: string | null + processing_started_at?: string | null + product_colors?: Json + product_id?: string | null + product_name: string + product_sku?: string | null + status?: string + technique_id?: string | null + technique_name: string + total_mockups?: number + updated_at?: string + user_id: string } Update: { + actual_cost?: number | null + ai_model?: string | null + areas_config?: Json + art_colors_count?: number | null + client_id?: string | null + colors_count?: number + completed_mockups?: number | null created_at?: string - granted_by?: string | null - role?: Database["public"]["Enums"]["app_role"] + custom_prompt?: string | null + error_message?: string | null + estimated_cost?: number | null + failed_mockups?: number | null + id?: string + logo_filename?: string | null + logo_url?: string + processing_completed_at?: string | null + processing_started_at?: string | null + product_colors?: Json + product_id?: string | null + product_name?: string + product_sku?: string | null + status?: string + technique_id?: string | null + technique_name?: string + total_mockups?: number + updated_at?: string user_id?: string } - Relationships: [] + Relationships: [ + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_generation_jobs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_generation_jobs_technique_id_fkey" + columns: ["technique_id"] + isOneToOne: false + referencedRelation: "personalization_techniques" + referencedColumns: ["id"] + }, + ] } - user_search_history: { + mockup_prompt_configs: { Row: { - created_at: string | null - history_type: string + ai_model: string + config_key: string + created_at: string id: string - is_pinned: boolean | null - metadata: Json | null - query_text: string - result_count: number | null - updated_at: string | null - user_id: string + is_active: boolean + label: string + prompt_text: string + technique_id: string | null + updated_at: string + version: number } Insert: { - created_at?: string | null - history_type?: string + ai_model?: string + config_key: string + created_at?: string id?: string - is_pinned?: boolean | null - metadata?: Json | null - query_text: string - result_count?: number | null - updated_at?: string | null - user_id: string + is_active?: boolean + label: string + prompt_text: string + technique_id?: string | null + updated_at?: string + version?: number } Update: { - created_at?: string | null - history_type?: string + ai_model?: string + config_key?: string + created_at?: string id?: string - is_pinned?: boolean | null - metadata?: Json | null - query_text?: string - result_count?: number | null - updated_at?: string | null - user_id?: string + is_active?: boolean + label?: string + prompt_text?: string + technique_id?: string | null + updated_at?: string + version?: number } Relationships: [] } - user_token_revocations: { + mockup_prompt_history: { Row: { - revoked_at: string - user_id: string + ai_model: string + change_notes: string | null + changed_at: string + changed_by: string | null + config_id: string + config_key: string + id: string + new_prompt: string + old_prompt: string | null + version: number } Insert: { - revoked_at?: string - user_id: string + ai_model: string + change_notes?: string | null + changed_at?: string + changed_by?: string | null + config_id: string + config_key: string + id?: string + new_prompt: string + old_prompt?: string | null + version: number } Update: { - revoked_at?: string - user_id?: string + ai_model?: string + change_notes?: string | null + changed_at?: string + changed_by?: string | null + config_id?: string + config_key?: string + id?: string + new_prompt?: string + old_prompt?: string | null + version?: number } Relationships: [] } - video_variant_links: { + mockup_templates: { Row: { + available_colors: Json | null created_at: string + default_technique_id: string | null + description: string | null id: string - product_id: string - supplier_code: string | null - variant_color_hex: string | null - variant_id: string - variant_name: string | null - video_id: string + is_active: boolean | null + is_featured: boolean | null + name: string + predefined_areas: Json + product_id: string | null + template_image_url: string + updated_at: string + usage_count: number | null } Insert: { + available_colors?: Json | null created_at?: string + default_technique_id?: string | null + description?: string | null id?: string - product_id: string - supplier_code?: string | null - variant_color_hex?: string | null - variant_id: string - variant_name?: string | null - video_id: string + is_active?: boolean | null + is_featured?: boolean | null + name: string + predefined_areas?: Json + product_id?: string | null + template_image_url: string + updated_at?: string + usage_count?: number | null } Update: { + available_colors?: Json | null created_at?: string + default_technique_id?: string | null + description?: string | null id?: string - product_id?: string - supplier_code?: string | null - variant_color_hex?: string | null - variant_id?: string - variant_name?: string | null - video_id?: string + is_active?: boolean | null + is_featured?: boolean | null + name?: string + predefined_areas?: Json + product_id?: string | null + template_image_url?: string + updated_at?: string + usage_count?: number | null + } + Relationships: [ + { + foreignKeyName: "mockup_templates_default_technique_id_fkey" + columns: ["default_technique_id"] + isOneToOne: false + referencedRelation: "personalization_techniques" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "mockup_templates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + ncm_codes: { + Row: { + chapter: string | null + chapter_desc: string | null + code: string + code_formatted: string | null + created_at: string | null + description: string | null + id: string + import_rate: number | null + ipi_rate: number | null + is_active: boolean | null + item: string | null + notes: string | null + organization_id: string | null + position: string | null + position_desc: string | null + source: string | null + subposition: string | null + updated_at: string | null + } + Insert: { + chapter?: string | null + chapter_desc?: string | null + code: string + code_formatted?: string | null + created_at?: string | null + description?: string | null + id?: string + import_rate?: number | null + ipi_rate?: number | null + is_active?: boolean | null + item?: string | null + notes?: string | null + organization_id?: string | null + position?: string | null + position_desc?: string | null + source?: string | null + subposition?: string | null + updated_at?: string | null + } + Update: { + chapter?: string | null + chapter_desc?: string | null + code?: string + code_formatted?: string | null + created_at?: string | null + description?: string | null + id?: string + import_rate?: number | null + ipi_rate?: number | null + is_active?: boolean | null + item?: string | null + notes?: string | null + organization_id?: string | null + position?: string | null + position_desc?: string | null + source?: string | null + subposition?: string | null + updated_at?: string | null } Relationships: [] } - voice_command_logs: { + notification_preferences: { Row: { - action: string - created_at: string - data: Json | null - duration_ms: number | null + created_at: string | null + email_notifications: boolean | null id: string - response: string | null - success: boolean | null - transcript: string + marketing: boolean | null + order_updates: boolean | null + push_notifications: boolean | null + quote_updates: boolean | null + system_announcements: boolean | null + updated_at: string | null user_id: string } Insert: { - action: string - created_at?: string - data?: Json | null - duration_ms?: number | null + created_at?: string | null + email_notifications?: boolean | null id?: string - response?: string | null - success?: boolean | null - transcript: string + marketing?: boolean | null + order_updates?: boolean | null + push_notifications?: boolean | null + quote_updates?: boolean | null + system_announcements?: boolean | null + updated_at?: string | null user_id: string } Update: { - action?: string - created_at?: string - data?: Json | null - duration_ms?: number | null + created_at?: string | null + email_notifications?: boolean | null id?: string - response?: string | null - success?: boolean | null - transcript?: string + marketing?: boolean | null + order_updates?: boolean | null + push_notifications?: boolean | null + quote_updates?: boolean | null + system_announcements?: boolean | null + updated_at?: string | null user_id?: string } Relationships: [] } - webhook_deliveries: { + notification_templates: { Row: { - attempt: number - delivered_at: string - error_message: string | null - event: string + body_template: string + code: string + created_at: string | null id: string - payload: Json | null - payload_hash: string | null - response_body_truncated: string | null - status_code: number | null - success: boolean - webhook_id: string + is_active: boolean | null + name: string + subject: string | null + updated_at: string | null + variables: Json | null } Insert: { - attempt?: number - delivered_at?: string - error_message?: string | null - event: string + body_template: string + code: string + created_at?: string | null id?: string - payload?: Json | null - payload_hash?: string | null - response_body_truncated?: string | null - status_code?: number | null - success?: boolean - webhook_id: string + is_active?: boolean | null + name: string + subject?: string | null + updated_at?: string | null + variables?: Json | null } Update: { - attempt?: number - delivered_at?: string - error_message?: string | null - event?: string + body_template?: string + code?: string + created_at?: string | null id?: string - payload?: Json | null - payload_hash?: string | null - response_body_truncated?: string | null - status_code?: number | null - success?: boolean - webhook_id?: string + is_active?: boolean | null + name?: string + subject?: string | null + updated_at?: string | null + variables?: Json | null } - Relationships: [ - { - foreignKeyName: "webhook_deliveries_webhook_id_fkey" - columns: ["webhook_id"] - isOneToOne: false - referencedRelation: "outbound_webhooks" - referencedColumns: ["id"] - }, - ] + Relationships: [] } - webhook_delivery_metrics: { + notifications: { Row: { - attempt: number | null - direction: string | null - duration_ms: number | null - endpoint: string | null - error_class: string | null - error_message: string | null - event_type: string | null - http_status: number | null + action_url: string | null + created_at: string | null + data: Json | null id: string - metadata: Json | null - occurred_at: string - payload_bytes: number | null - request_id: string | null - source: string | null - success: boolean | null + is_read: boolean | null + message: string + priority: string | null + read_at: string | null + title: string + type: string + user_id: string } Insert: { - attempt?: number | null - direction?: string | null - duration_ms?: number | null - endpoint?: string | null - error_class?: string | null - error_message?: string | null - event_type?: string | null - http_status?: number | null + action_url?: string | null + created_at?: string | null + data?: Json | null id?: string - metadata?: Json | null - occurred_at?: string - payload_bytes?: number | null - request_id?: string | null - source?: string | null - success?: boolean | null + is_read?: boolean | null + message: string + priority?: string | null + read_at?: string | null + title: string + type: string + user_id: string } Update: { - attempt?: number | null - direction?: string | null - duration_ms?: number | null - endpoint?: string | null - error_class?: string | null - error_message?: string | null - event_type?: string | null - http_status?: number | null + action_url?: string | null + created_at?: string | null + data?: Json | null id?: string - metadata?: Json | null - occurred_at?: string - payload_bytes?: number | null - request_id?: string | null - source?: string | null - success?: boolean | null + is_read?: boolean | null + message?: string + priority?: string | null + read_at?: string | null + title?: string + type?: string + user_id?: string } Relationships: [] } - webhook_delivery_metrics_y2026m05: { + optimization_queue: { Row: { - attempt: number | null - direction: string | null - duration_ms: number | null - endpoint: string | null - error_class: string | null - error_message: string | null - event_type: string | null - http_status: number | null + category: string + created_at: string + created_by: string | null + description: string | null + error: string | null + finished_at: string | null + guardrail_status: string | null id: string - metadata: Json | null - occurred_at: string - payload_bytes: number | null - request_id: string | null - source: string | null - success: boolean | null + priority: number + result: Json | null + started_at: string | null + status: string + title: string + updated_at: string } Insert: { - attempt?: number | null - direction?: string | null - duration_ms?: number | null - endpoint?: string | null - error_class?: string | null - error_message?: string | null - event_type?: string | null - http_status?: number | null + category?: string + created_at?: string + created_by?: string | null + description?: string | null + error?: string | null + finished_at?: string | null + guardrail_status?: string | null id?: string - metadata?: Json | null - occurred_at?: string - payload_bytes?: number | null - request_id?: string | null - source?: string | null - success?: boolean | null + priority?: number + result?: Json | null + started_at?: string | null + status?: string + title: string + updated_at?: string } Update: { - attempt?: number | null - direction?: string | null - duration_ms?: number | null - endpoint?: string | null - error_class?: string | null - error_message?: string | null - event_type?: string | null - http_status?: number | null + category?: string + created_at?: string + created_by?: string | null + description?: string | null + error?: string | null + finished_at?: string | null + guardrail_status?: string | null id?: string - metadata?: Json | null - occurred_at?: string - payload_bytes?: number | null - request_id?: string | null - source?: string | null - success?: boolean | null + priority?: number + result?: Json | null + started_at?: string | null + status?: string + title?: string + updated_at?: string } Relationships: [] } - webhook_delivery_metrics_y2026m06: { + optimization_queue_runs: { Row: { - attempt: number | null - direction: string | null + created_at: string duration_ms: number | null - endpoint: string | null - error_class: string | null - error_message: string | null - event_type: string | null - http_status: number | null + executed_by: string | null + guardrail_status: string | null id: string - metadata: Json | null - occurred_at: string - payload_bytes: number | null - request_id: string | null - source: string | null - success: boolean | null + notes: string | null + queue_id: string + status: string } Insert: { - attempt?: number | null - direction?: string | null + created_at?: string duration_ms?: number | null - endpoint?: string | null - error_class?: string | null - error_message?: string | null - event_type?: string | null - http_status?: number | null + executed_by?: string | null + guardrail_status?: string | null id?: string - metadata?: Json | null - occurred_at?: string - payload_bytes?: number | null - request_id?: string | null - source?: string | null - success?: boolean | null + notes?: string | null + queue_id: string + status: string } Update: { - attempt?: number | null - direction?: string | null + created_at?: string duration_ms?: number | null - endpoint?: string | null - error_class?: string | null - error_message?: string | null - event_type?: string | null - http_status?: number | null + executed_by?: string | null + guardrail_status?: string | null id?: string - metadata?: Json | null - occurred_at?: string - payload_bytes?: number | null - request_id?: string | null - source?: string | null - success?: boolean | null + notes?: string | null + queue_id?: string + status?: string + } + Relationships: [ + { + foreignKeyName: "optimization_queue_runs_queue_id_fkey" + columns: ["queue_id"] + isOneToOne: false + referencedRelation: "optimization_queue" + referencedColumns: ["id"] + }, + ] + } + order_item_personalizations: { + Row: { + created_at: string | null + id: string + image_url: string | null + location_id: string | null + location_name: string | null + order_item_id: string + personalization_text: string | null + price_adjustment: number | null + technique_id: string | null + technique_name: string | null + updated_at: string | null + } + Insert: { + created_at?: string | null + id?: string + image_url?: string | null + location_id?: string | null + location_name?: string | null + order_item_id: string + personalization_text?: string | null + price_adjustment?: number | null + technique_id?: string | null + technique_name?: string | null + updated_at?: string | null + } + Update: { + created_at?: string | null + id?: string + image_url?: string | null + location_id?: string | null + location_name?: string | null + order_item_id?: string + personalization_text?: string | null + price_adjustment?: number | null + technique_id?: string | null + technique_name?: string | null + updated_at?: string | null } Relationships: [] } - workspace_notifications: { + order_items: { Row: { - action_url: string | null + created_at: string + discount_amount: number | null + id: string + order_id: string | null + personalization_config: Json | null + personalization_cost: number | null + product_description: string | null + product_id: string | null + product_image_url: string | null + product_name: string | null + product_sku: string | null + production_notes: string | null + production_status: string | null + quantity: number + quote_item_id: string | null + subtotal: number + unit_price: number + updated_at: string | null + } + Insert: { + created_at?: string + discount_amount?: number | null + id?: string + order_id?: string | null + personalization_config?: Json | null + personalization_cost?: number | null + product_description?: string | null + product_id?: string | null + product_image_url?: string | null + product_name?: string | null + product_sku?: string | null + production_notes?: string | null + production_status?: string | null + quantity?: number + quote_item_id?: string | null + subtotal: number + unit_price: number + updated_at?: string | null + } + Update: { + created_at?: string + discount_amount?: number | null + id?: string + order_id?: string | null + personalization_config?: Json | null + personalization_cost?: number | null + product_description?: string | null + product_id?: string | null + product_image_url?: string | null + product_name?: string | null + product_sku?: string | null + production_notes?: string | null + production_status?: string | null + quantity?: number + quote_item_id?: string | null + subtotal?: number + unit_price?: number + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "order_items_order_id_fkey" + columns: ["order_id"] + isOneToOne: false + referencedRelation: "orders" + referencedColumns: ["id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "order_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + orders: { + Row: { + assigned_to: string | null + client_company: string | null + client_email: string | null + client_id: string | null + client_name: string | null + client_phone: string | null + created_at: string + created_by: string | null + delivered_at: string | null + delivery_address: string | null + delivery_time: string | null + discount_amount: number | null + estimated_delivery_date: string | null + fulfillment_status: string | null + id: string + internal_notes: string | null + notes: string | null + order_number: string + organization_id: string | null + paid_amount: number | null + payment_due_date: string | null + payment_method: string | null + payment_status: string | null + payment_terms: string | null + quote_id: string | null + seller_id: string | null + shipping_address: Json | null + shipping_cost: number | null + shipping_method: string | null + shipping_type: string | null + status: string | null + subtotal: number | null + tax_amount: number | null + total: number + tracking_number: string | null + updated_at: string + version: number + } + Insert: { + assigned_to?: string | null + client_company?: string | null + client_email?: string | null + client_id?: string | null + client_name?: string | null + client_phone?: string | null + created_at?: string + created_by?: string | null + delivered_at?: string | null + delivery_address?: string | null + delivery_time?: string | null + discount_amount?: number | null + estimated_delivery_date?: string | null + fulfillment_status?: string | null + id?: string + internal_notes?: string | null + notes?: string | null + order_number: string + organization_id?: string | null + paid_amount?: number | null + payment_due_date?: string | null + payment_method?: string | null + payment_status?: string | null + payment_terms?: string | null + quote_id?: string | null + seller_id?: string | null + shipping_address?: Json | null + shipping_cost?: number | null + shipping_method?: string | null + shipping_type?: string | null + status?: string | null + subtotal?: number | null + tax_amount?: number | null + total?: number + tracking_number?: string | null + updated_at?: string + version?: number + } + Update: { + assigned_to?: string | null + client_company?: string | null + client_email?: string | null + client_id?: string | null + client_name?: string | null + client_phone?: string | null + created_at?: string + created_by?: string | null + delivered_at?: string | null + delivery_address?: string | null + delivery_time?: string | null + discount_amount?: number | null + estimated_delivery_date?: string | null + fulfillment_status?: string | null + id?: string + internal_notes?: string | null + notes?: string | null + order_number?: string + organization_id?: string | null + paid_amount?: number | null + payment_due_date?: string | null + payment_method?: string | null + payment_status?: string | null + payment_terms?: string | null + quote_id?: string | null + seller_id?: string | null + shipping_address?: Json | null + shipping_cost?: number | null + shipping_method?: string | null + shipping_type?: string | null + status?: string | null + subtotal?: number | null + tax_amount?: number | null + total?: number + tracking_number?: string | null + updated_at?: string + version?: number + } + Relationships: [ + { + foreignKeyName: "orders_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + ] + } + organization_members: { + Row: { + created_at: string + id: string + invited_by: string | null + joined_at: string + organization_id: string + role: Database["public"]["Enums"]["org_role"] + updated_at: string + user_id: string + } + Insert: { + created_at?: string + id?: string + invited_by?: string | null + joined_at?: string + organization_id: string + role?: Database["public"]["Enums"]["org_role"] + updated_at?: string + user_id: string + } + Update: { + created_at?: string + id?: string + invited_by?: string | null + joined_at?: string + organization_id?: string + role?: Database["public"]["Enums"]["org_role"] + updated_at?: string + user_id?: string + } + Relationships: [ + { + foreignKeyName: "organization_members_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + ] + } + organizations: { + Row: { + created_at: string + description: string | null + id: string + is_active: boolean + logo_url: string | null + name: string + settings: Json | null + slug: string + updated_at: string + } + Insert: { + created_at?: string + description?: string | null + id?: string + is_active?: boolean + logo_url?: string | null + name: string + settings?: Json | null + slug: string + updated_at?: string + } + Update: { + created_at?: string + description?: string | null + id?: string + is_active?: boolean + logo_url?: string | null + name?: string + settings?: Json | null + slug?: string + updated_at?: string + } + Relationships: [] + } + outbound_webhooks: { + Row: { + active: boolean + auto_disabled_at: string | null + auto_disabled_reason: string | null + consecutive_failures: number + created_at: string + created_by: string + description: string | null + events: string[] + id: string + last_triggered_at: string | null + name: string + retry_policy: Json + secret_ref: string | null + total_failure: number + total_success: number + updated_at: string + url: string + } + Insert: { + active?: boolean + auto_disabled_at?: string | null + auto_disabled_reason?: string | null + consecutive_failures?: number + created_at?: string + created_by: string + description?: string | null + events?: string[] + id?: string + last_triggered_at?: string | null + name: string + retry_policy?: Json + secret_ref?: string | null + total_failure?: number + total_success?: number + updated_at?: string + url: string + } + Update: { + active?: boolean + auto_disabled_at?: string | null + auto_disabled_reason?: string | null + consecutive_failures?: number + created_at?: string + created_by?: string + description?: string | null + events?: string[] + id?: string + last_triggered_at?: string | null + name?: string + retry_policy?: Json + secret_ref?: string | null + total_failure?: number + total_success?: number + updated_at?: string + url?: string + } + Relationships: [] + } + ownership_audit_reports: { + Row: { + details: Json + duration_ms: number | null + generated_at: string + id: string + missing_user_count: number + null_owner_count: number + rls_coverage: Json + rls_gaps_count: number + total_issues_found: number + total_tables_scanned: number + triggered_by: string + } + Insert: { + details?: Json + duration_ms?: number | null + generated_at?: string + id?: string + missing_user_count?: number + null_owner_count?: number + rls_coverage?: Json + rls_gaps_count?: number + total_issues_found?: number + total_tables_scanned?: number + triggered_by?: string + } + Update: { + details?: Json + duration_ms?: number | null + generated_at?: string + id?: string + missing_user_count?: number + null_owner_count?: number + rls_coverage?: Json + rls_gaps_count?: number + total_issues_found?: number + total_tables_scanned?: number + triggered_by?: string + } + Relationships: [] + } + ownership_repair_logs: { + Row: { + action: string + created_at: string + dry_run: boolean + error_message: string | null + id: string + issue_type: string + notes: string | null + owner_column: string + report_id: string | null + rows_affected: number + table_name: string + triggered_by: string | null + triggered_by_label: string | null + } + Insert: { + action: string + created_at?: string + dry_run?: boolean + error_message?: string | null + id?: string + issue_type: string + notes?: string | null + owner_column: string + report_id?: string | null + rows_affected?: number + table_name: string + triggered_by?: string | null + triggered_by_label?: string | null + } + Update: { + action?: string + created_at?: string + dry_run?: boolean + error_message?: string | null + id?: string + issue_type?: string + notes?: string | null + owner_column?: string + report_id?: string | null + rows_affected?: number + table_name?: string + triggered_by?: string | null + triggered_by_label?: string | null + } + Relationships: [] + } + packaging_compatibility_config: { + Row: { + config_key: string + config_value: string + created_at: string | null + description: string | null + id: string + } + Insert: { + config_key: string + config_value: string + created_at?: string | null + description?: string | null + id?: string + } + Update: { + config_key?: string + config_value?: string + created_at?: string | null + description?: string | null + id?: string + } + Relationships: [] + } + packaging_types: { + Row: { + active: boolean | null + code: string + created_at: string | null + description: string | null + id: string + is_display: boolean | null + is_gift_box: boolean | null + is_protective: boolean | null + name: string + updated_at: string | null + } + Insert: { + active?: boolean | null + code: string + created_at?: string | null + description?: string | null + id?: string + is_display?: boolean | null + is_gift_box?: boolean | null + is_protective?: boolean | null + name: string + updated_at?: string | null + } + Update: { + active?: boolean | null + code?: string + created_at?: string | null + description?: string | null + id?: string + is_display?: boolean | null + is_gift_box?: boolean | null + is_protective?: boolean | null + name?: string + updated_at?: string | null + } + Relationships: [] + } + packagings: { + Row: { + active: boolean | null + code: string | null + color: string | null + created_at: string | null + description: string | null + external_diameter_cm: number | null + external_height_cm: number | null + external_length_cm: number | null + external_width_cm: number | null + id: string + internal_diameter_cm: number | null + internal_height_cm: number | null + internal_length_cm: number | null + internal_width_cm: number | null + is_customizable: boolean | null + material: string | null + name: string + packaging_type_id: string | null + print_area_height_cm: number | null + print_area_width_cm: number | null + updated_at: string | null + weight_g: number | null + } + Insert: { + active?: boolean | null + code?: string | null + color?: string | null + created_at?: string | null + description?: string | null + external_diameter_cm?: number | null + external_height_cm?: number | null + external_length_cm?: number | null + external_width_cm?: number | null + id?: string + internal_diameter_cm?: number | null + internal_height_cm?: number | null + internal_length_cm?: number | null + internal_width_cm?: number | null + is_customizable?: boolean | null + material?: string | null + name: string + packaging_type_id?: string | null + print_area_height_cm?: number | null + print_area_width_cm?: number | null + updated_at?: string | null + weight_g?: number | null + } + Update: { + active?: boolean | null + code?: string | null + color?: string | null + created_at?: string | null + description?: string | null + external_diameter_cm?: number | null + external_height_cm?: number | null + external_length_cm?: number | null + external_width_cm?: number | null + id?: string + internal_diameter_cm?: number | null + internal_height_cm?: number | null + internal_length_cm?: number | null + internal_width_cm?: number | null + is_customizable?: boolean | null + material?: string | null + name?: string + packaging_type_id?: string | null + print_area_height_cm?: number | null + print_area_width_cm?: number | null + updated_at?: string | null + weight_g?: number | null + } + Relationships: [ + { + foreignKeyName: "packagings_packaging_type_id_fkey" + columns: ["packaging_type_id"] + isOneToOne: false + referencedRelation: "packaging_types" + referencedColumns: ["id"] + }, + ] + } + password_reset_requests: { + Row: { + email: string + id: string + requested_at: string | null + reviewed_at: string | null + reviewed_by: string | null + reviewer_notes: string | null + status: string + user_id: string | null + } + Insert: { + email: string + id?: string + requested_at?: string | null + reviewed_at?: string | null + reviewed_by?: string | null + reviewer_notes?: string | null + status?: string + user_id?: string | null + } + Update: { + email?: string + id?: string + requested_at?: string | null + reviewed_at?: string | null + reviewed_by?: string | null + reviewer_notes?: string | null + status?: string + user_id?: string | null + } + Relationships: [] + } + permissions: { + Row: { + category: string + code: string + created_at: string + description: string | null + label: string + } + Insert: { + category: string + code: string + created_at?: string + description?: string | null + label: string + } + Update: { + category?: string + code?: string + created_at?: string + description?: string | null + label?: string + } + Relationships: [] + } + personalization_simulations: { + Row: { + client_id: string | null + created_at: string + id: string + notes: string | null + product_id: string | null + product_name: string | null + product_sku: string | null + product_unit_price: number | null + quantity: number | null + seller_id: string + simulation_data: Json + } + Insert: { + client_id?: string | null + created_at?: string + id?: string + notes?: string | null + product_id?: string | null + product_name?: string | null + product_sku?: string | null + product_unit_price?: number | null + quantity?: number | null + seller_id: string + simulation_data?: Json + } + Update: { + client_id?: string | null + created_at?: string + id?: string + notes?: string | null + product_id?: string | null + product_name?: string | null + product_sku?: string | null + product_unit_price?: number | null + quantity?: number | null + seller_id?: string + simulation_data?: Json + } + Relationships: [ + { + foreignKeyName: "personalization_simulations_client_id_fkey" + columns: ["client_id"] + isOneToOne: false + referencedRelation: "bitrix_clients" + referencedColumns: ["id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "personalization_simulations_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + personalization_techniques: { + Row: { + base_cost_multiplier: number | null + code: string + created_at: string + description: string | null + id: string + is_active: boolean | null + name: string + prompt_suffix: string + requires_color_count: boolean | null + updated_at: string + } + Insert: { + base_cost_multiplier?: number | null + code: string + created_at?: string + description?: string | null + id?: string + is_active?: boolean | null + name: string + prompt_suffix: string + requires_color_count?: boolean | null + updated_at?: string + } + Update: { + base_cost_multiplier?: number | null + code?: string + created_at?: string + description?: string | null + id?: string + is_active?: boolean | null + name?: string + prompt_suffix?: string + requires_color_count?: boolean | null + updated_at?: string + } + Relationships: [] + } + price_history: { + Row: { + change_reason: string | null + change_type: string + changed_at: string | null + changed_by: string | null + id: string + new_values: Json | null + old_values: Json | null + source: string | null + variant_id: string + } + Insert: { + change_reason?: string | null + change_type: string + changed_at?: string | null + changed_by?: string | null + id?: string + new_values?: Json | null + old_values?: Json | null + source?: string | null + variant_id: string + } + Update: { + change_reason?: string | null + change_type?: string + changed_at?: string | null + changed_by?: string | null + id?: string + new_values?: Json | null + old_values?: Json | null + source?: string | null + variant_id?: string + } + Relationships: [ + { + foreignKeyName: "price_history_changed_by_fkey" + columns: ["changed_by"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + }, + { + foreignKeyName: "price_history_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "product_variants" + referencedColumns: ["id"] + }, + { + foreignKeyName: "price_history_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "price_history_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "price_history_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_variant_sale_prices" + referencedColumns: ["variant_id"] + }, + ] + } + print_area_techniques: { + Row: { + created_at: string | null + id: string + is_active: boolean + is_curved: boolean + location_code: string + location_name: string | null + location_order: number | null + max_height: number + max_width: number + notes: string | null + product_id: string + shape: string + tabela_preco_id: string + technique_order: number + unit_cost: number | null + updated_at: string | null + } + Insert: { + created_at?: string | null + id?: string + is_active?: boolean + is_curved?: boolean + location_code: string + location_name?: string | null + location_order?: number | null + max_height: number + max_width: number + notes?: string | null + product_id: string + shape?: string + tabela_preco_id: string + technique_order?: number + unit_cost?: number | null + updated_at?: string | null + } + Update: { + created_at?: string | null + id?: string + is_active?: boolean + is_curved?: boolean + location_code?: string + location_name?: string | null + location_order?: number | null + max_height?: number + max_width?: number + notes?: string | null + product_id?: string + shape?: string + tabela_preco_id?: string + technique_order?: number + unit_cost?: number | null + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pat_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "print_area_techniques_tabela_preco_id_fkey" + columns: ["tabela_preco_id"] + isOneToOne: false + referencedRelation: "tabela_preco_gravacao_oficial" + referencedColumns: ["id"] + }, + ] + } + product_ai_history: { + Row: { + ai_description: string + ai_title: string + completion_tokens: number | null + context_snapshot: Json + created_at: string + generated_at: string + generation_time_ms: number | null + id: string + model: string + product_id: string + prompt_tokens: number | null + total_tokens: number | null + version: number + } + Insert: { + ai_description: string + ai_title: string + completion_tokens?: number | null + context_snapshot?: Json + created_at?: string + generated_at?: string + generation_time_ms?: number | null + id?: string + model: string + product_id: string + prompt_tokens?: number | null + total_tokens?: number | null + version: number + } + Update: { + ai_description?: string + ai_title?: string + completion_tokens?: number | null + context_snapshot?: Json + created_at?: string + generated_at?: string + generation_time_ms?: number | null + id?: string + model?: string + product_id?: string + prompt_tokens?: number | null + total_tokens?: number | null + version?: number + } + Relationships: [ + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_ai_history_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + product_category_assignments: { + Row: { + category_id: string + created_at: string | null + display_order: number | null + id: string + is_primary: boolean | null + product_id: string + } + Insert: { + category_id: string + created_at?: string | null + display_order?: number | null + id?: string + is_primary?: boolean | null + product_id: string + } + Update: { + category_id?: string + created_at?: string | null + display_order?: number | null + id?: string + is_primary?: boolean | null + product_id?: string + } + Relationships: [ + { + foreignKeyName: "product_category_assignments_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_category_assignments_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "product_category_assignments_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "product_category_assignments_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "product_category_assignments_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "product_category_assignments_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_category_assignments_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + product_commemorative_dates: { + Row: { + category_id: string | null + commemorative_date_id: string + created_at: string | null + custom_message: string | null + display_order: number | null + id: string + is_active: boolean + is_featured: boolean | null + product_id: string + relevance_score: number | null + source: string | null + updated_at: string | null + } + Insert: { + category_id?: string | null + commemorative_date_id: string + created_at?: string | null + custom_message?: string | null + display_order?: number | null + id?: string + is_active?: boolean + is_featured?: boolean | null + product_id: string + relevance_score?: number | null + source?: string | null + updated_at?: string | null + } + Update: { + category_id?: string | null + commemorative_date_id?: string + created_at?: string | null + custom_message?: string | null + display_order?: number | null + id?: string + is_active?: boolean + is_featured?: boolean | null + product_id?: string + relevance_score?: number | null + source?: string | null + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "product_commemorative_dates_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_commemorative_dates_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "product_commemorative_dates_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "product_commemorative_dates_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "product_commemorative_dates_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "product_commemorative_dates_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "product_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "commemorative_dates" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "v_commemorative_dates_calendar" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "v_commemorative_dates_with_colors" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["commemorative_date_id"] + }, + { + foreignKeyName: "product_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["date_id"] + }, + { + foreignKeyName: "product_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["date_id"] + }, + { + foreignKeyName: "product_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["date_id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + product_component_location_techniques: { + Row: { + component_location_id: string + composed_code: string | null + created_at: string + id: string + is_active: boolean + max_colors: number | null + technique_id: string + updated_at: string + } + Insert: { + component_location_id: string + composed_code?: string | null + created_at?: string + id?: string + is_active?: boolean + max_colors?: number | null + technique_id: string + updated_at?: string + } + Update: { + component_location_id?: string + composed_code?: string | null + created_at?: string + id?: string + is_active?: boolean + max_colors?: number | null + technique_id?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "product_component_location_technique_component_location_id_fkey" + columns: ["component_location_id"] + isOneToOne: false + referencedRelation: "product_component_locations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_component_location_techniques_technique_id_fkey" + columns: ["technique_id"] + isOneToOne: false + referencedRelation: "personalization_techniques" + referencedColumns: ["id"] + }, + ] + } + product_component_locations: { + Row: { + component_id: string + created_at: string + description: string | null + id: string + is_active: boolean + location_code: string + location_name: string + max_height_cm: number | null + max_width_cm: number | null + sort_order: number | null + updated_at: string + } + Insert: { + component_id: string + created_at?: string + description?: string | null + id?: string + is_active?: boolean + location_code: string + location_name: string + max_height_cm?: number | null + max_width_cm?: number | null + sort_order?: number | null + updated_at?: string + } + Update: { + component_id?: string + created_at?: string + description?: string | null + id?: string + is_active?: boolean + location_code?: string + location_name?: string + max_height_cm?: number | null + max_width_cm?: number | null + sort_order?: number | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "product_component_locations_component_id_fkey" + columns: ["component_id"] + isOneToOne: false + referencedRelation: "product_components" + referencedColumns: ["id"] + }, + ] + } + product_components: { + Row: { + component_code: string + component_name: string + created_at: string + id: string + is_active: boolean + is_personalizable: boolean + product_id: string + sort_order: number | null + updated_at: string + } + Insert: { + component_code: string + component_name: string + created_at?: string + id?: string + is_active?: boolean + is_personalizable?: boolean + product_id: string + sort_order?: number | null + updated_at?: string + } + Update: { + component_code?: string + component_name?: string + created_at?: string + id?: string + is_active?: boolean + is_personalizable?: boolean + product_id?: string + sort_order?: number | null + updated_at?: string + } + Relationships: [] + } + product_faqs: { + Row: { + answer: string + answer_html: string | null + category_id: string | null + created_at: string | null + created_by: string | null + display_order: number | null + faq_scope: string + helpful_count: number | null + id: string + is_active: boolean | null + is_featured: boolean | null + keywords: string[] | null + not_helpful_count: number | null + product_id: string | null + question: string + updated_at: string | null + view_count: number | null + } + Insert: { + answer: string + answer_html?: string | null + category_id?: string | null + created_at?: string | null + created_by?: string | null + display_order?: number | null + faq_scope?: string + helpful_count?: number | null + id?: string + is_active?: boolean | null + is_featured?: boolean | null + keywords?: string[] | null + not_helpful_count?: number | null + product_id?: string | null + question: string + updated_at?: string | null + view_count?: number | null + } + Update: { + answer?: string + answer_html?: string | null + category_id?: string | null + created_at?: string | null + created_by?: string | null + display_order?: number | null + faq_scope?: string + helpful_count?: number | null + id?: string + is_active?: boolean | null + is_featured?: boolean | null + keywords?: string[] | null + not_helpful_count?: number | null + product_id?: string | null + question?: string + updated_at?: string | null + view_count?: number | null + } + Relationships: [ + { + foreignKeyName: "product_faqs_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_faqs_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "product_faqs_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "product_faqs_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "product_faqs_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "product_faqs_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_faqs_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + product_group_components: { + Row: { + component_code: string + component_name: string + created_at: string + description: string | null + id: string + is_active: boolean + product_group_id: string + sort_order: number + updated_at: string + } + Insert: { + component_code: string + component_name: string + created_at?: string + description?: string | null + id?: string + is_active?: boolean + product_group_id: string + sort_order?: number + updated_at?: string + } + Update: { + component_code?: string + component_name?: string + created_at?: string + description?: string | null + id?: string + is_active?: boolean + product_group_id?: string + sort_order?: number + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "product_group_components_product_group_id_fkey" + columns: ["product_group_id"] + isOneToOne: false + referencedRelation: "product_groups" + referencedColumns: ["id"] + }, + ] + } + product_group_location_techniques: { + Row: { + created_at: string + group_location_id: string + id: string + is_active: boolean + max_colors: number | null + technique_id: string + updated_at: string + } + Insert: { + created_at?: string + group_location_id: string + id?: string + is_active?: boolean + max_colors?: number | null + technique_id: string + updated_at?: string + } + Update: { + created_at?: string + group_location_id?: string + id?: string + is_active?: boolean + max_colors?: number | null + technique_id?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "product_group_location_techniques_group_location_id_fkey" + columns: ["group_location_id"] + isOneToOne: false + referencedRelation: "product_group_locations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_group_location_techniques_technique_id_fkey" + columns: ["technique_id"] + isOneToOne: false + referencedRelation: "personalization_techniques" + referencedColumns: ["id"] + }, + ] + } + product_group_locations: { + Row: { + created_at: string + description: string | null + group_component_id: string + id: string + is_active: boolean + location_code: string + location_name: string + max_area_cm2: number | null + max_height_cm: number | null + max_width_cm: number | null + sort_order: number + updated_at: string + } + Insert: { + created_at?: string + description?: string | null + group_component_id: string + id?: string + is_active?: boolean + location_code: string + location_name: string + max_area_cm2?: number | null + max_height_cm?: number | null + max_width_cm?: number | null + sort_order?: number + updated_at?: string + } + Update: { + created_at?: string + description?: string | null + group_component_id?: string + id?: string + is_active?: boolean + location_code?: string + location_name?: string + max_area_cm2?: number | null + max_height_cm?: number | null + max_width_cm?: number | null + sort_order?: number + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "product_group_locations_group_component_id_fkey" + columns: ["group_component_id"] + isOneToOne: false + referencedRelation: "product_group_components" + referencedColumns: ["id"] + }, + ] + } + product_group_members: { + Row: { + created_at: string + id: string + product_group_id: string + product_id: string + updated_at: string + use_group_rules: boolean + } + Insert: { + created_at?: string + id?: string + product_group_id: string + product_id: string + updated_at?: string + use_group_rules?: boolean + } + Update: { + created_at?: string + id?: string + product_group_id?: string + product_id?: string + updated_at?: string + use_group_rules?: boolean + } + Relationships: [ + { + foreignKeyName: "product_group_members_product_group_id_fkey" + columns: ["product_group_id"] + isOneToOne: false + referencedRelation: "product_groups" + referencedColumns: ["id"] + }, + ] + } + product_groups: { + Row: { + created_at: string + description: string | null + group_code: string + group_name: string + id: string + is_active: boolean + updated_at: string + } + Insert: { + created_at?: string + description?: string | null + group_code: string + group_name: string + id?: string + is_active?: boolean + updated_at?: string + } + Update: { + created_at?: string + description?: string | null + group_code?: string + group_name?: string + id?: string + is_active?: boolean + updated_at?: string + } + Relationships: [] + } + product_images: { + Row: { + alt_text: string | null + applies_to_color: boolean | null + caption: string | null + cloudflare_image_id: string + color_id: string | null + created_at: string | null + display_order: number | null + file_size_bytes: number | null + filename: string | null + format: string | null + height_px: number | null + id: string + image_type: string + image_type_id: string | null + is_active: boolean | null + is_og_image: boolean | null + is_primary: boolean | null + organization_id: string + product_id: string + source_supplier: string | null + supplier_code: string | null + title_text: string | null + updated_at: string | null + url_cdn: string + url_original: string | null + variant_id: string | null + width_px: number | null + } + Insert: { + alt_text?: string | null + applies_to_color?: boolean | null + caption?: string | null + cloudflare_image_id: string + color_id?: string | null + created_at?: string | null + display_order?: number | null + file_size_bytes?: number | null + filename?: string | null + format?: string | null + height_px?: number | null + id?: string + image_type?: string + image_type_id?: string | null + is_active?: boolean | null + is_og_image?: boolean | null + is_primary?: boolean | null + organization_id?: string + product_id: string + source_supplier?: string | null + supplier_code?: string | null + title_text?: string | null + updated_at?: string | null + url_cdn: string + url_original?: string | null + variant_id?: string | null + width_px?: number | null + } + Update: { + alt_text?: string | null + applies_to_color?: boolean | null + caption?: string | null + cloudflare_image_id?: string + color_id?: string | null + created_at?: string | null + display_order?: number | null + file_size_bytes?: number | null + filename?: string | null + format?: string | null + height_px?: number | null + id?: string + image_type?: string + image_type_id?: string | null + is_active?: boolean | null + is_og_image?: boolean | null + is_primary?: boolean | null + organization_id?: string + product_id?: string + source_supplier?: string | null + supplier_code?: string | null + title_text?: string | null + updated_at?: string | null + url_cdn?: string + url_original?: string | null + variant_id?: string | null + width_px?: number | null + } + Relationships: [ + { + foreignKeyName: "fk_product_images_image_type" + columns: ["image_type_id"] + isOneToOne: false + referencedRelation: "image_types" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_product_images_image_type" + columns: ["image_type_id"] + isOneToOne: false + referencedRelation: "v_image_types_complete" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_color_id_fkey" + columns: ["color_id"] + isOneToOne: false + referencedRelation: "color_variations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_color_id_fkey" + columns: ["color_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["promo_variation_id"] + }, + { + foreignKeyName: "product_images_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "product_variants" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "product_images_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "product_images_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_variant_sale_prices" + referencedColumns: ["variant_id"] + }, + ] + } + product_included_packagings: { + Row: { + active: boolean | null + can_be_customized: boolean | null + can_be_disabled: boolean | null + color: string | null + cradle_material: string | null + created_at: string | null + description: string | null + external_height_cm: number | null + external_length_cm: number | null + external_width_cm: number | null + finish: string | null + has_inner_cradle: boolean | null + id: string + internal_diameter_cm: number | null + internal_height_cm: number | null + internal_length_cm: number | null + internal_width_cm: number | null + is_default: boolean | null + material: string | null + name: string + notes: string | null + product_id: string + supplier_packaging_code: string | null + supplier_packaging_name: string | null + updated_at: string | null + weight_g: number | null + } + Insert: { + active?: boolean | null + can_be_customized?: boolean | null + can_be_disabled?: boolean | null + color?: string | null + cradle_material?: string | null + created_at?: string | null + description?: string | null + external_height_cm?: number | null + external_length_cm?: number | null + external_width_cm?: number | null + finish?: string | null + has_inner_cradle?: boolean | null + id?: string + internal_diameter_cm?: number | null + internal_height_cm?: number | null + internal_length_cm?: number | null + internal_width_cm?: number | null + is_default?: boolean | null + material?: string | null + name: string + notes?: string | null + product_id: string + supplier_packaging_code?: string | null + supplier_packaging_name?: string | null + updated_at?: string | null + weight_g?: number | null + } + Update: { + active?: boolean | null + can_be_customized?: boolean | null + can_be_disabled?: boolean | null + color?: string | null + cradle_material?: string | null + created_at?: string | null + description?: string | null + external_height_cm?: number | null + external_length_cm?: number | null + external_width_cm?: number | null + finish?: string | null + has_inner_cradle?: boolean | null + id?: string + internal_diameter_cm?: number | null + internal_height_cm?: number | null + internal_length_cm?: number | null + internal_width_cm?: number | null + is_default?: boolean | null + material?: string | null + name?: string + notes?: string | null + product_id?: string + supplier_packaging_code?: string | null + supplier_packaging_name?: string | null + updated_at?: string | null + weight_g?: number | null + } + Relationships: [ + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_included_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + product_kit_components: { + Row: { + allowed_variant_ids: Json | null + allows_personalization: boolean | null + color: string | null + component_code: string | null + component_description: string | null + component_name: string | null + component_product_id: string | null + component_sku: string | null + component_type_code: string | null + created_at: string | null + display_order: number | null + height_mm: number | null + id: string + images: Json | null + is_optional: boolean | null + is_packaging: boolean | null + is_replaceable: boolean | null + kit_product_id: string + length_mm: number | null + material: string | null + material_type_id: string | null + notes: string | null + personalization_notes: string | null + primary_image_url: string | null + quantity: number + secondary_material_type_id: string | null + supplier_component_code: string | null + updated_at: string | null + weight_g: number | null + width_mm: number | null + } + Insert: { + allowed_variant_ids?: Json | null + allows_personalization?: boolean | null + color?: string | null + component_code?: string | null + component_description?: string | null + component_name?: string | null + component_product_id?: string | null + component_sku?: string | null + component_type_code?: string | null + created_at?: string | null + display_order?: number | null + height_mm?: number | null + id?: string + images?: Json | null + is_optional?: boolean | null + is_packaging?: boolean | null + is_replaceable?: boolean | null + kit_product_id: string + length_mm?: number | null + material?: string | null + material_type_id?: string | null + notes?: string | null + personalization_notes?: string | null + primary_image_url?: string | null + quantity?: number + secondary_material_type_id?: string | null + supplier_component_code?: string | null + updated_at?: string | null + weight_g?: number | null + width_mm?: number | null + } + Update: { + allowed_variant_ids?: Json | null + allows_personalization?: boolean | null + color?: string | null + component_code?: string | null + component_description?: string | null + component_name?: string | null + component_product_id?: string | null + component_sku?: string | null + component_type_code?: string | null + created_at?: string | null + display_order?: number | null + height_mm?: number | null + id?: string + images?: Json | null + is_optional?: boolean | null + is_packaging?: boolean | null + is_replaceable?: boolean | null + kit_product_id?: string + length_mm?: number | null + material?: string | null + material_type_id?: string | null + notes?: string | null + personalization_notes?: string | null + primary_image_url?: string | null + quantity?: number + secondary_material_type_id?: string | null + supplier_component_code?: string | null + updated_at?: string | null + weight_g?: number | null + width_mm?: number | null + } + Relationships: [ + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_component_product_id_fkey" + columns: ["component_product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_component_type_code_fkey" + columns: ["component_type_code"] + isOneToOne: false + referencedRelation: "kit_component_types" + referencedColumns: ["code"] + }, + { + foreignKeyName: "product_kit_components_component_type_code_fkey" + columns: ["component_type_code"] + isOneToOne: false + referencedRelation: "vw_component_types_usage" + referencedColumns: ["code"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_kit_product_id_fkey" + columns: ["kit_product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_material_type_id_fkey" + columns: ["material_type_id"] + isOneToOne: false + referencedRelation: "material_types" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_material_type_id_fkey" + columns: ["material_type_id"] + isOneToOne: false + referencedRelation: "materials_complete" + referencedColumns: ["material_id"] + }, + { + foreignKeyName: "product_kit_components_material_type_id_fkey" + columns: ["material_type_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["material_id"] + }, + { + foreignKeyName: "product_kit_components_secondary_material_type_id_fkey" + columns: ["secondary_material_type_id"] + isOneToOne: false + referencedRelation: "material_types" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_kit_components_secondary_material_type_id_fkey" + columns: ["secondary_material_type_id"] + isOneToOne: false + referencedRelation: "materials_complete" + referencedColumns: ["material_id"] + }, + { + foreignKeyName: "product_kit_components_secondary_material_type_id_fkey" + columns: ["secondary_material_type_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["material_id"] + }, + ] + } + product_materials: { + Row: { + created_at: string | null + created_by: string | null + id: string + is_active: boolean | null + material_id: string + notes: string | null + organization_id: string + part: string | null + percentage: number | null + product_id: string + sort_order: number | null + updated_at: string | null + updated_by: string | null + } + Insert: { + created_at?: string | null + created_by?: string | null + id?: string + is_active?: boolean | null + material_id: string + notes?: string | null + organization_id: string + part?: string | null + percentage?: number | null + product_id: string + sort_order?: number | null + updated_at?: string | null + updated_by?: string | null + } + Update: { + created_at?: string | null + created_by?: string | null + id?: string + is_active?: boolean | null + material_id?: string + notes?: string | null + organization_id?: string + part?: string | null + percentage?: number | null + product_id?: string + sort_order?: number | null + updated_at?: string | null + updated_by?: string | null + } + Relationships: [ + { + foreignKeyName: "product_materials_material_id_fkey" + columns: ["material_id"] + isOneToOne: false + referencedRelation: "material_types" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_materials_material_id_fkey" + columns: ["material_id"] + isOneToOne: false + referencedRelation: "materials_complete" + referencedColumns: ["material_id"] + }, + { + foreignKeyName: "product_materials_material_id_fkey" + columns: ["material_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["material_id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_materials_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + product_packaging_compatibility: { + Row: { + active: boolean | null + compatibility_source: string + created_at: string | null + display_order: number | null + fit_gap_avg_mm: number | null + fit_gap_diameter_mm: number | null + fit_gap_height_mm: number | null + fit_gap_length_mm: number | null + fit_gap_min_mm: number | null + fit_gap_width_mm: number | null + fit_rating: string | null + id: string + is_recommended: boolean | null + is_same_supplier: boolean | null + is_verified: boolean | null + notes: string | null + packaging_id: string + product_id: string + supplier_reference_code: string | null + supplier_reference_text: string | null + updated_at: string | null + verification_notes: string | null + verified_at: string | null + } + Insert: { + active?: boolean | null + compatibility_source?: string + created_at?: string | null + display_order?: number | null + fit_gap_avg_mm?: number | null + fit_gap_diameter_mm?: number | null + fit_gap_height_mm?: number | null + fit_gap_length_mm?: number | null + fit_gap_min_mm?: number | null + fit_gap_width_mm?: number | null + fit_rating?: string | null + id?: string + is_recommended?: boolean | null + is_same_supplier?: boolean | null + is_verified?: boolean | null + notes?: string | null + packaging_id: string + product_id: string + supplier_reference_code?: string | null + supplier_reference_text?: string | null + updated_at?: string | null + verification_notes?: string | null + verified_at?: string | null + } + Update: { + active?: boolean | null + compatibility_source?: string + created_at?: string | null + display_order?: number | null + fit_gap_avg_mm?: number | null + fit_gap_diameter_mm?: number | null + fit_gap_height_mm?: number | null + fit_gap_length_mm?: number | null + fit_gap_min_mm?: number | null + fit_gap_width_mm?: number | null + fit_rating?: string | null + id?: string + is_recommended?: boolean | null + is_same_supplier?: boolean | null + is_verified?: boolean | null + notes?: string | null + packaging_id?: string + product_id?: string + supplier_reference_code?: string | null + supplier_reference_text?: string | null + updated_at?: string | null + verification_notes?: string | null + verified_at?: string | null + } + Relationships: [ + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packaging_compatibility_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + product_packagings: { + Row: { + active: boolean | null + additional_price: number | null + created_at: string | null + currency: string | null + id: string + min_quantity: number | null + notes: string | null + packaging_id: string + product_id: string + relationship_type: string + updated_at: string | null + } + Insert: { + active?: boolean | null + additional_price?: number | null + created_at?: string | null + currency?: string | null + id?: string + min_quantity?: number | null + notes?: string | null + packaging_id: string + product_id: string + relationship_type?: string + updated_at?: string | null + } + Update: { + active?: boolean | null + additional_price?: number | null + created_at?: string | null + currency?: string | null + id?: string + min_quantity?: number | null + notes?: string | null + packaging_id?: string + product_id?: string + relationship_type?: string + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "product_packagings_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "packagings" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packagings_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["packaging_id"] + }, + { + foreignKeyName: "product_packagings_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["packaging_id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_packagings_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + product_price_freshness_overrides: { + Row: { + created_at: string + id: string + product_id: string + threshold_days: number + updated_at: string + updated_by: string | null + } + Insert: { + created_at?: string + id?: string + product_id: string + threshold_days: number + updated_at?: string + updated_by?: string | null + } + Update: { + created_at?: string + id?: string + product_id?: string + threshold_days?: number + updated_at?: string + updated_by?: string | null + } + Relationships: [] + } + product_properties: { + Row: { + created_at: string | null + id: string + product_id: string + property_code: string + property_definition_id: string | null + property_value: string | null + raw_value: string | null + source: string | null + updated_at: string | null + } + Insert: { + created_at?: string | null + id?: string + product_id: string + property_code: string + property_definition_id?: string | null + property_value?: string | null + raw_value?: string | null + source?: string | null + updated_at?: string | null + } + Update: { + created_at?: string | null + id?: string + product_id?: string + property_code?: string + property_definition_id?: string | null + property_value?: string | null + raw_value?: string | null + source?: string | null + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_properties_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_properties_property_definition_id_fkey" + columns: ["property_definition_id"] + isOneToOne: false + referencedRelation: "property_definitions" + referencedColumns: ["id"] + }, + ] + } + product_relationships: { + Row: { + created_at: string | null + display_order: number | null + id: string + is_active: boolean | null + is_bidirectional: boolean | null + product_id: string + related_product_id: string + relationship_type: string + } + Insert: { + created_at?: string | null + display_order?: number | null + id?: string + is_active?: boolean | null + is_bidirectional?: boolean | null + product_id: string + related_product_id: string + relationship_type: string + } + Update: { + created_at?: string | null + display_order?: number | null + id?: string + is_active?: boolean | null + is_bidirectional?: boolean | null + product_id?: string + related_product_id?: string + relationship_type?: string + } + Relationships: [ + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_relationships_related_product_id_fkey" + columns: ["related_product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + product_search_logs: { + Row: { + created_at: string | null + filters: Json | null + id: string + latency_ms: number | null + query: string + results_count: number | null + } + Insert: { + created_at?: string | null + filters?: Json | null + id?: string + latency_ms?: number | null + query: string + results_count?: number | null + } + Update: { + created_at?: string | null + filters?: Json | null + id?: string + latency_ms?: number | null + query?: string + results_count?: number | null + } + Relationships: [] + } + product_similarity_group_members: { + Row: { + created_at: string + group_id: string + id: string + is_reference_product: boolean + match_source: string + notes: string | null + product_id: string + similarity_score: number + supplier_id: string + } + Insert: { + created_at?: string + group_id: string + id?: string + is_reference_product?: boolean + match_source?: string + notes?: string | null + product_id: string + similarity_score?: number + supplier_id: string + } + Update: { + created_at?: string + group_id?: string + id?: string + is_reference_product?: boolean + match_source?: string + notes?: string | null + product_id?: string + similarity_score?: number + supplier_id?: string + } + Relationships: [ + { + foreignKeyName: "product_similarity_group_members_group_id_fkey" + columns: ["group_id"] + isOneToOne: false + referencedRelation: "product_similarity_groups" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_similarity_group_members_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_similarity_group_members_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_similarity_group_members_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "product_similarity_group_members_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "product_similarity_group_members_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + product_similarity_groups: { + Row: { + capacity_band: string + capacity_max: number | null + capacity_min: number | null + category_id: string | null + created_at: string + id: string + is_active: boolean + match_criteria: Json | null + match_source: string + material_family: string + name: string + notes: string | null + updated_at: string + } + Insert: { + capacity_band: string + capacity_max?: number | null + capacity_min?: number | null + category_id?: string | null + created_at?: string + id?: string + is_active?: boolean + match_criteria?: Json | null + match_source?: string + material_family: string + name: string + notes?: string | null + updated_at?: string + } + Update: { + capacity_band?: string + capacity_max?: number | null + capacity_min?: number | null + category_id?: string | null + created_at?: string + id?: string + is_active?: boolean + match_criteria?: Json | null + match_source?: string + material_family?: string + name?: string + notes?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "product_similarity_groups_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_similarity_groups_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "product_similarity_groups_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "product_similarity_groups_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "product_similarity_groups_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "product_similarity_groups_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + ] + } + product_sync_logs: { + Row: { + completed_at: string | null + created_at: string + duration_ms: number | null + error_message: string | null + id: string + payload: Json | null + products_created: number | null + products_failed: number | null + products_received: number | null + products_updated: number | null + records_failed: number + records_inserted: number + records_processed: number + records_updated: number + source: string + status: string + triggered_by: string | null + } + Insert: { + completed_at?: string | null + created_at?: string + duration_ms?: number | null + error_message?: string | null + id?: string + payload?: Json | null + products_created?: number | null + products_failed?: number | null + products_received?: number | null + products_updated?: number | null + records_failed?: number + records_inserted?: number + records_processed?: number + records_updated?: number + source: string + status?: string + triggered_by?: string | null + } + Update: { + completed_at?: string | null + created_at?: string + duration_ms?: number | null + error_message?: string | null + id?: string + payload?: Json | null + products_created?: number | null + products_failed?: number | null + products_received?: number | null + products_updated?: number | null + records_failed?: number + records_inserted?: number + records_processed?: number + records_updated?: number + source?: string + status?: string + triggered_by?: string | null + } + Relationships: [] + } + product_tags: { + Row: { + created_at: string | null + id: string + product_id: string + tag_id: string + } + Insert: { + created_at?: string | null + id?: string + product_id: string + tag_id: string + } + Update: { + created_at?: string | null + id?: string + product_id?: string + tag_id?: string + } + Relationships: [ + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_tags_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_tags_tag_id_fkey" + columns: ["tag_id"] + isOneToOne: false + referencedRelation: "tags" + referencedColumns: ["id"] + }, + ] + } + product_target_audiences: { + Row: { + category_id: string | null + created_at: string | null + id: string + is_active: boolean + is_featured: boolean | null + product_id: string + relevance_score: number | null + source: string | null + target_audience_id: string + updated_at: string | null + } + Insert: { + category_id?: string | null + created_at?: string | null + id?: string + is_active?: boolean + is_featured?: boolean | null + product_id: string + relevance_score?: number | null + source?: string | null + target_audience_id: string + updated_at?: string | null + } + Update: { + category_id?: string | null + created_at?: string | null + id?: string + is_active?: boolean + is_featured?: boolean | null + product_id?: string + relevance_score?: number | null + source?: string | null + target_audience_id?: string + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "product_target_audiences_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_target_audiences_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "product_target_audiences_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "product_target_audiences_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "product_target_audiences_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "product_target_audiences_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_target_audiences_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_target_audiences_target_audience_id_fkey" + columns: ["target_audience_id"] + isOneToOne: false + referencedRelation: "target_audiences" + referencedColumns: ["id"] + }, + ] + } + product_variants: { + Row: { + attributes: Json + bitrix_product_id: number | null + capacity_ml: number | null + CodigoXbz: string | null + color_code: string | null + color_hex: string | null + color_id: string | null + color_name: string | null + created_at: string | null + id: string + images: Json | null + is_active: boolean | null + last_sync_at: string | null + last_sync_supplier_id: string | null + name: string + product_id: string + selected_thumbnail: string | null + size_code: string | null + size_id: string | null + sku: string + sku_promo: string | null + stock_quantity: number | null + supplier_sku: string | null + updated_at: string | null + } + Insert: { + attributes: Json + bitrix_product_id?: number | null + capacity_ml?: number | null + CodigoXbz?: string | null + color_code?: string | null + color_hex?: string | null + color_id?: string | null + color_name?: string | null + created_at?: string | null + id?: string + images?: Json | null + is_active?: boolean | null + last_sync_at?: string | null + last_sync_supplier_id?: string | null + name: string + product_id: string + selected_thumbnail?: string | null + size_code?: string | null + size_id?: string | null + sku: string + sku_promo?: string | null + stock_quantity?: number | null + supplier_sku?: string | null + updated_at?: string | null + } + Update: { + attributes?: Json + bitrix_product_id?: number | null + capacity_ml?: number | null + CodigoXbz?: string | null + color_code?: string | null + color_hex?: string | null + color_id?: string | null + color_name?: string | null + created_at?: string | null + id?: string + images?: Json | null + is_active?: boolean | null + last_sync_at?: string | null + last_sync_supplier_id?: string | null + name?: string + product_id?: string + selected_thumbnail?: string | null + size_code?: string | null + size_id?: string | null + sku?: string + sku_promo?: string | null + stock_quantity?: number | null + supplier_sku?: string | null + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "product_variants_color_id_fkey" + columns: ["color_id"] + isOneToOne: false + referencedRelation: "color_variations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_color_id_fkey" + columns: ["color_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["promo_variation_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_size_id_fkey" + columns: ["size_id"] + isOneToOne: false + referencedRelation: "variation_values" + referencedColumns: ["id"] + }, + ] + } + product_videos: { + Row: { + cloudflare_error: string | null + cloudflare_status: string | null + cloudflare_video_id: string + created_at: string | null + description: string | null + display_order: number | null + duration_seconds: number | null + file_size_bytes: number | null + filename: string | null + height_px: number | null + id: string + is_active: boolean | null + is_primary: boolean | null + organization_id: string + product_id: string + source_supplier: string | null + source_youtube_id: string | null + title: string | null + updated_at: string | null + uploaded_at: string | null + url_dash: string | null + url_hls: string | null + url_original: string | null + url_stream: string + url_thumbnail: string | null + video_type: string + video_type_id: string | null + width_px: number | null + } + Insert: { + cloudflare_error?: string | null + cloudflare_status?: string | null + cloudflare_video_id: string + created_at?: string | null + description?: string | null + display_order?: number | null + duration_seconds?: number | null + file_size_bytes?: number | null + filename?: string | null + height_px?: number | null + id?: string + is_active?: boolean | null + is_primary?: boolean | null + organization_id?: string + product_id: string + source_supplier?: string | null + source_youtube_id?: string | null + title?: string | null + updated_at?: string | null + uploaded_at?: string | null + url_dash?: string | null + url_hls?: string | null + url_original?: string | null + url_stream: string + url_thumbnail?: string | null + video_type?: string + video_type_id?: string | null + width_px?: number | null + } + Update: { + cloudflare_error?: string | null + cloudflare_status?: string | null + cloudflare_video_id?: string + created_at?: string | null + description?: string | null + display_order?: number | null + duration_seconds?: number | null + file_size_bytes?: number | null + filename?: string | null + height_px?: number | null + id?: string + is_active?: boolean | null + is_primary?: boolean | null + organization_id?: string + product_id?: string + source_supplier?: string | null + source_youtube_id?: string | null + title?: string | null + updated_at?: string | null + uploaded_at?: string | null + url_dash?: string | null + url_hls?: string | null + url_original?: string | null + url_stream?: string + url_thumbnail?: string | null + video_type?: string + video_type_id?: string | null + width_px?: number | null + } + Relationships: [ + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_video_type_id_fkey" + columns: ["video_type_id"] + isOneToOne: false + referencedRelation: "video_types" + referencedColumns: ["id"] + }, + ] + } + product_views: { + Row: { + created_at: string + id: string + product_id: string | null + product_name: string | null + product_sku: string | null + seller_id: string | null + view_type: string | null + } + Insert: { + created_at?: string + id?: string + product_id?: string | null + product_name?: string | null + product_sku?: string | null + seller_id?: string | null + view_type?: string | null + } + Update: { + created_at?: string + id?: string + product_id?: string | null + product_name?: string | null + product_sku?: string | null + seller_id?: string | null + view_type?: string | null + } + Relationships: [] + } + products: { + Row: { + active: boolean | null + ai_description: string | null + ai_generated_at: string | null + ai_model: string | null + ai_summary: string | null + ai_title: string | null + ai_version: number | null + allows_personalization: boolean | null + auto_category: string | null + auto_material: string | null + bitrix_images_synced_at: string | null + bitrix_product_id: number | null + box_height_cm: number | null + box_height_mm: number | null + box_image: string | null + box_inner_quantity: number | null + box_length_cm: number | null + box_length_mm: number | null + box_quantity: number | null + box_volume_cm3: number | null + box_weight_kg: number | null + box_width_cm: number | null + box_width_mm: number | null + brand: string | null + canonical_url: string | null + capacities: string | null + capacity_ml: number | null + catalog_page: number | null + category_id: string | null + classification_confidence: number | null + colors: Json | null + combined_sizes: string | null + cost_price: number | null + cradle_material: string | null + created_at: string + created_by: string | null + cubic_weight: number | null + deleted_at: string | null + description: string | null + description_packaging_info: Json | null + diameter_cm: number | null + dimensions: Json | null + dimensions_display: string | null + ean: string | null + engraving_type: string | null + external_id: string | null + favorite_count: number | null + freight_class: string | null + gender: string | null + gtin: string | null + has_capacity: boolean | null + has_colors: boolean | null + has_commercial_packaging: boolean | null + has_gift_box: boolean | null + has_inner_cradle: boolean | null + has_optional_packaging: boolean | null + has_sizes: boolean | null + height_cm: number | null + id: string + images: Json | null + internal_diameter_cm: number | null + internal_height_cm: number | null + internal_length_cm: number | null + internal_width_cm: number | null + ipi_rate: number | null + is_active: boolean | null + is_bestseller: boolean | null + is_bestseller_expires_at: string | null + is_deleted: boolean | null + is_featured: boolean | null + is_featured_expires_at: string | null + is_imported: boolean | null + is_kit: boolean | null + is_new: boolean | null + is_new_expires_at: string | null + is_on_sale: boolean | null + is_on_sale_expires_at: string | null + is_online_exclusive: boolean | null + is_stockout: boolean | null + is_textil: boolean | null + is_thermal: boolean | null + key_benefits: string[] | null + last_stock_update_at: string | null + last_sync_at: string | null + last_sync_supplier_id: string | null + lead_time_days: number | null + length_cm: number | null + main_category_id: string | null + manufacturer_sku: string | null + materials: Json | null + meta_description: string | null + meta_keywords: string[] | null + meta_title: string | null + min_order_quantity: number | null + min_quantity: number | null + name: string + ncm_code: string | null + ncm_id: string | null + novelty_detected_at: string | null + novelty_expires_at: string | null + og_description: string | null + og_image_url: string | null + og_title: string | null + optional_packaging_ref: string | null + order_count: number | null + organization_id: string | null + origin_country: string | null + packaging_color: string | null + packaging_context: string | null + packaging_finish: string | null + packaging_material: string | null + packing_classification: string | null + packing_type: string | null + price_updated_at: string | null + primary_image_url: string | null + product_type: string | null + repacking_classification: string | null + repacking_type: string | null + requires_minimum_order: boolean | null + robots_meta: string | null + sale_price: number | null + schema_json: Json | null + seo_issues: Json | null + seo_last_audit_at: string | null + seo_score: number | null + shape_type: string | null + short_description: string | null + sku: string | null + sku_promo: string | null + slug: string | null + stock_quantity: number | null + suggested_price: number | null + supplier_id: string | null + supplier_product_url: string | null + supplier_reference: string | null + supplier_updated_at: string | null + supply_mode: string | null + sync_status: string | null + tags: Json | null + target_audience: string[] | null + tax_reference_state: string | null + updated_at: string + updated_by: string | null + use_cases: string[] | null + videos: Json | null + view_count: number | null + warranty_months: number | null + weight_g: number | null + width_cm: number | null + } + Insert: { + active?: boolean | null + ai_description?: string | null + ai_generated_at?: string | null + ai_model?: string | null + ai_summary?: string | null + ai_title?: string | null + ai_version?: number | null + allows_personalization?: boolean | null + auto_category?: string | null + auto_material?: string | null + bitrix_images_synced_at?: string | null + bitrix_product_id?: number | null + box_height_cm?: number | null + box_height_mm?: number | null + box_image?: string | null + box_inner_quantity?: number | null + box_length_cm?: number | null + box_length_mm?: number | null + box_quantity?: number | null + box_volume_cm3?: number | null + box_weight_kg?: number | null + box_width_cm?: number | null + box_width_mm?: number | null + brand?: string | null + canonical_url?: string | null + capacities?: string | null + capacity_ml?: number | null + catalog_page?: number | null + category_id?: string | null + classification_confidence?: number | null + colors?: Json | null + combined_sizes?: string | null + cost_price?: number | null + cradle_material?: string | null + created_at?: string + created_by?: string | null + cubic_weight?: number | null + deleted_at?: string | null + description?: string | null + description_packaging_info?: Json | null + diameter_cm?: number | null + dimensions?: Json | null + dimensions_display?: string | null + ean?: string | null + engraving_type?: string | null + external_id?: string | null + favorite_count?: number | null + freight_class?: string | null + gender?: string | null + gtin?: string | null + has_capacity?: boolean | null + has_colors?: boolean | null + has_commercial_packaging?: boolean | null + has_gift_box?: boolean | null + has_inner_cradle?: boolean | null + has_optional_packaging?: boolean | null + has_sizes?: boolean | null + height_cm?: number | null + id?: string + images?: Json | null + internal_diameter_cm?: number | null + internal_height_cm?: number | null + internal_length_cm?: number | null + internal_width_cm?: number | null + ipi_rate?: number | null + is_active?: boolean | null + is_bestseller?: boolean | null + is_bestseller_expires_at?: string | null + is_deleted?: boolean | null + is_featured?: boolean | null + is_featured_expires_at?: string | null + is_imported?: boolean | null + is_kit?: boolean | null + is_new?: boolean | null + is_new_expires_at?: string | null + is_on_sale?: boolean | null + is_on_sale_expires_at?: string | null + is_online_exclusive?: boolean | null + is_stockout?: boolean | null + is_textil?: boolean | null + is_thermal?: boolean | null + key_benefits?: string[] | null + last_stock_update_at?: string | null + last_sync_at?: string | null + last_sync_supplier_id?: string | null + lead_time_days?: number | null + length_cm?: number | null + main_category_id?: string | null + manufacturer_sku?: string | null + materials?: Json | null + meta_description?: string | null + meta_keywords?: string[] | null + meta_title?: string | null + min_order_quantity?: number | null + min_quantity?: number | null + name: string + ncm_code?: string | null + ncm_id?: string | null + novelty_detected_at?: string | null + novelty_expires_at?: string | null + og_description?: string | null + og_image_url?: string | null + og_title?: string | null + optional_packaging_ref?: string | null + order_count?: number | null + organization_id?: string | null + origin_country?: string | null + packaging_color?: string | null + packaging_context?: string | null + packaging_finish?: string | null + packaging_material?: string | null + packing_classification?: string | null + packing_type?: string | null + price_updated_at?: string | null + primary_image_url?: string | null + product_type?: string | null + repacking_classification?: string | null + repacking_type?: string | null + requires_minimum_order?: boolean | null + robots_meta?: string | null + sale_price?: number | null + schema_json?: Json | null + seo_issues?: Json | null + seo_last_audit_at?: string | null + seo_score?: number | null + shape_type?: string | null + short_description?: string | null + sku?: string | null + sku_promo?: string | null + slug?: string | null + stock_quantity?: number | null + suggested_price?: number | null + supplier_id?: string | null + supplier_product_url?: string | null + supplier_reference?: string | null + supplier_updated_at?: string | null + supply_mode?: string | null + sync_status?: string | null + tags?: Json | null + target_audience?: string[] | null + tax_reference_state?: string | null + updated_at?: string + updated_by?: string | null + use_cases?: string[] | null + videos?: Json | null + view_count?: number | null + warranty_months?: number | null + weight_g?: number | null + width_cm?: number | null + } + Update: { + active?: boolean | null + ai_description?: string | null + ai_generated_at?: string | null + ai_model?: string | null + ai_summary?: string | null + ai_title?: string | null + ai_version?: number | null + allows_personalization?: boolean | null + auto_category?: string | null + auto_material?: string | null + bitrix_images_synced_at?: string | null + bitrix_product_id?: number | null + box_height_cm?: number | null + box_height_mm?: number | null + box_image?: string | null + box_inner_quantity?: number | null + box_length_cm?: number | null + box_length_mm?: number | null + box_quantity?: number | null + box_volume_cm3?: number | null + box_weight_kg?: number | null + box_width_cm?: number | null + box_width_mm?: number | null + brand?: string | null + canonical_url?: string | null + capacities?: string | null + capacity_ml?: number | null + catalog_page?: number | null + category_id?: string | null + classification_confidence?: number | null + colors?: Json | null + combined_sizes?: string | null + cost_price?: number | null + cradle_material?: string | null + created_at?: string + created_by?: string | null + cubic_weight?: number | null + deleted_at?: string | null + description?: string | null + description_packaging_info?: Json | null + diameter_cm?: number | null + dimensions?: Json | null + dimensions_display?: string | null + ean?: string | null + engraving_type?: string | null + external_id?: string | null + favorite_count?: number | null + freight_class?: string | null + gender?: string | null + gtin?: string | null + has_capacity?: boolean | null + has_colors?: boolean | null + has_commercial_packaging?: boolean | null + has_gift_box?: boolean | null + has_inner_cradle?: boolean | null + has_optional_packaging?: boolean | null + has_sizes?: boolean | null + height_cm?: number | null + id?: string + images?: Json | null + internal_diameter_cm?: number | null + internal_height_cm?: number | null + internal_length_cm?: number | null + internal_width_cm?: number | null + ipi_rate?: number | null + is_active?: boolean | null + is_bestseller?: boolean | null + is_bestseller_expires_at?: string | null + is_deleted?: boolean | null + is_featured?: boolean | null + is_featured_expires_at?: string | null + is_imported?: boolean | null + is_kit?: boolean | null + is_new?: boolean | null + is_new_expires_at?: string | null + is_on_sale?: boolean | null + is_on_sale_expires_at?: string | null + is_online_exclusive?: boolean | null + is_stockout?: boolean | null + is_textil?: boolean | null + is_thermal?: boolean | null + key_benefits?: string[] | null + last_stock_update_at?: string | null + last_sync_at?: string | null + last_sync_supplier_id?: string | null + lead_time_days?: number | null + length_cm?: number | null + main_category_id?: string | null + manufacturer_sku?: string | null + materials?: Json | null + meta_description?: string | null + meta_keywords?: string[] | null + meta_title?: string | null + min_order_quantity?: number | null + min_quantity?: number | null + name?: string + ncm_code?: string | null + ncm_id?: string | null + novelty_detected_at?: string | null + novelty_expires_at?: string | null + og_description?: string | null + og_image_url?: string | null + og_title?: string | null + optional_packaging_ref?: string | null + order_count?: number | null + organization_id?: string | null + origin_country?: string | null + packaging_color?: string | null + packaging_context?: string | null + packaging_finish?: string | null + packaging_material?: string | null + packing_classification?: string | null + packing_type?: string | null + price_updated_at?: string | null + primary_image_url?: string | null + product_type?: string | null + repacking_classification?: string | null + repacking_type?: string | null + requires_minimum_order?: boolean | null + robots_meta?: string | null + sale_price?: number | null + schema_json?: Json | null + seo_issues?: Json | null + seo_last_audit_at?: string | null + seo_score?: number | null + shape_type?: string | null + short_description?: string | null + sku?: string | null + sku_promo?: string | null + slug?: string | null + stock_quantity?: number | null + suggested_price?: number | null + supplier_id?: string | null + supplier_product_url?: string | null + supplier_reference?: string | null + supplier_updated_at?: string | null + supply_mode?: string | null + sync_status?: string | null + tags?: Json | null + target_audience?: string[] | null + tax_reference_state?: string | null + updated_at?: string + updated_by?: string | null + use_cases?: string[] | null + videos?: Json | null + view_count?: number | null + warranty_months?: number | null + weight_g?: number | null + width_cm?: number | null + } + Relationships: [ + { + foreignKeyName: "products_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "products_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "products_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "products_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "products_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "products_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "products_main_category_id_fkey" + columns: ["main_category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "products_main_category_id_fkey" + columns: ["main_category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "products_main_category_id_fkey" + columns: ["main_category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "products_main_category_id_fkey" + columns: ["main_category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "products_main_category_id_fkey" + columns: ["main_category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "products_main_category_id_fkey" + columns: ["main_category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "products_ncm_id_fkey" + columns: ["ncm_id"] + isOneToOne: false + referencedRelation: "ncm_codes" + referencedColumns: ["id"] + }, + { + foreignKeyName: "products_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "products_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "products_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "products_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "products_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + produto_ramo_atividade: { + Row: { + created_at: string | null + id: string + produto_id: string + ramo_atividade_filho_id: string + } + Insert: { + created_at?: string | null + id?: string + produto_id: string + ramo_atividade_filho_id: string + } + Update: { + created_at?: string | null + id?: string + produto_id?: string + ramo_atividade_filho_id?: string + } + Relationships: [ + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "produto_ramo_atividade_produto_id_fkey" + columns: ["produto_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "produto_ramo_atividade_ramo_atividade_filho_id_fkey" + columns: ["ramo_atividade_filho_id"] + isOneToOne: false + referencedRelation: "ramo_atividade_filho" + referencedColumns: ["id"] + }, + ] + } + profiles: { + Row: { + avatar_url: string | null + bitrix_id: number | null + created_at: string + department: string | null + email: string | null + full_name: string | null + id: string + is_active: boolean | null + last_login_at: string | null + phone: string | null + preferences: Json | null + role: string | null + updated_at: string + user_id: string | null + } + Insert: { + avatar_url?: string | null + bitrix_id?: number | null + created_at?: string + department?: string | null + email?: string | null + full_name?: string | null + id?: string + is_active?: boolean | null + last_login_at?: string | null + phone?: string | null + preferences?: Json | null + role?: string | null + updated_at?: string + user_id?: string | null + } + Update: { + avatar_url?: string | null + bitrix_id?: number | null + created_at?: string + department?: string | null + email?: string | null + full_name?: string | null + id?: string + is_active?: boolean | null + last_login_at?: string | null + phone?: string | null + preferences?: Json | null + role?: string | null + updated_at?: string + user_id?: string | null + } + Relationships: [] + } + property_definitions: { + Row: { + active: boolean | null + category: string + code: string + created_at: string | null + display_order: number | null + icon_code: string | null + id: string + is_premium_indicator: boolean | null + is_thermal_indicator: boolean | null + name_en: string | null + name_pt: string + updated_at: string | null + } + Insert: { + active?: boolean | null + category: string + code: string + created_at?: string | null + display_order?: number | null + icon_code?: string | null + id?: string + is_premium_indicator?: boolean | null + is_thermal_indicator?: boolean | null + name_en?: string | null + name_pt: string + updated_at?: string | null + } + Update: { + active?: boolean | null + category?: string + code?: string + created_at?: string | null + display_order?: number | null + icon_code?: string | null + id?: string + is_premium_indicator?: boolean | null + is_thermal_indicator?: boolean | null + name_en?: string | null + name_pt?: string + updated_at?: string | null + } + Relationships: [] + } + public_token_failures: { + Row: { + attempted_token: string | null + created_at: string + id: string + ip_address: string | null + reason: string | null + resource_id: string | null + resource_type: string + user_agent: string | null + } + Insert: { + attempted_token?: string | null + created_at?: string + id?: string + ip_address?: string | null + reason?: string | null + resource_id?: string | null + resource_type: string + user_agent?: string | null + } + Update: { + attempted_token?: string | null + created_at?: string + id?: string + ip_address?: string | null + reason?: string | null + resource_id?: string | null + resource_type?: string + user_agent?: string | null + } + Relationships: [] + } + push_subscriptions: { + Row: { + created_at: string | null + endpoint: string + id: string + is_active: boolean | null + keys: Json + updated_at: string | null + user_id: string + } + Insert: { + created_at?: string | null + endpoint: string + id?: string + is_active?: boolean | null + keys: Json + updated_at?: string | null + user_id: string + } + Update: { + created_at?: string | null + endpoint?: string + id?: string + is_active?: boolean | null + keys?: Json + updated_at?: string | null + user_id?: string + } + Relationships: [] + } + query_telemetry: { + Row: { + cache_hit: boolean + count_mode: string | null + created_at: string + duration_ms: number + error_kind: string | null + error_message: string | null + id: string + is_503: boolean + is_cold_start: boolean + operation: string + query_limit: number | null + query_offset: number | null + record_count: number | null + retry_count: number + rpc_name: string | null + severity: string + table_name: string | null + user_id: string | null + } + Insert: { + cache_hit?: boolean + count_mode?: string | null + created_at?: string + duration_ms: number + error_kind?: string | null + error_message?: string | null + id?: string + is_503?: boolean + is_cold_start?: boolean + operation: string + query_limit?: number | null + query_offset?: number | null + record_count?: number | null + retry_count?: number + rpc_name?: string | null + severity?: string + table_name?: string | null + user_id?: string | null + } + Update: { + cache_hit?: boolean + count_mode?: string | null + created_at?: string + duration_ms?: number + error_kind?: string | null + error_message?: string | null + id?: string + is_503?: boolean + is_cold_start?: boolean + operation?: string + query_limit?: number | null + query_offset?: number | null + record_count?: number | null + retry_count?: number + rpc_name?: string | null + severity?: string + table_name?: string | null + user_id?: string | null + } + Relationships: [] + } + quote_approval_tokens: { + Row: { + client_email: string | null + client_name: string | null + created_at: string + expires_at: string | null + id: string + quote_id: string + responded_at: string | null + response: string | null + response_notes: string | null + seller_id: string + signature_hash: string | null + signed_at: string | null + signer_document: string | null + signer_ip: string | null + signer_name: string | null + signer_user_agent: string | null + status: string + token: string + updated_at: string + viewed_at: string | null + } + Insert: { + client_email?: string | null + client_name?: string | null + created_at?: string + expires_at?: string | null + id?: string + quote_id: string + responded_at?: string | null + response?: string | null + response_notes?: string | null + seller_id: string + signature_hash?: string | null + signed_at?: string | null + signer_document?: string | null + signer_ip?: string | null + signer_name?: string | null + signer_user_agent?: string | null + status?: string + token?: string + updated_at?: string + viewed_at?: string | null + } + Update: { + client_email?: string | null + client_name?: string | null + created_at?: string + expires_at?: string | null + id?: string + quote_id?: string + responded_at?: string | null + response?: string | null + response_notes?: string | null + seller_id?: string + signature_hash?: string | null + signed_at?: string | null + signer_document?: string | null + signer_ip?: string | null + signer_name?: string | null + signer_user_agent?: string | null + status?: string + token?: string + updated_at?: string + viewed_at?: string | null + } + Relationships: [] + } + quote_comments: { + Row: { + comment: string + created_at: string | null + id: string + is_internal: boolean | null + quote_id: string + updated_at: string | null + user_id: string + } + Insert: { + comment: string + created_at?: string | null + id?: string + is_internal?: boolean | null + quote_id: string + updated_at?: string | null + user_id: string + } + Update: { + comment?: string + created_at?: string | null + id?: string + is_internal?: boolean | null + quote_id?: string + updated_at?: string | null + user_id?: string + } + Relationships: [ + { + foreignKeyName: "quote_comments_quote_id_fkey" + columns: ["quote_id"] + isOneToOne: false + referencedRelation: "quotes" + referencedColumns: ["id"] + }, + ] + } + quote_drafts: { + Row: { + data: Json + id: string + last_saved_at: string | null + user_id: string + } + Insert: { + data: Json + id?: string + last_saved_at?: string | null + user_id: string + } + Update: { + data?: Json + id?: string + last_saved_at?: string | null + user_id?: string + } + Relationships: [] + } + quote_history: { + Row: { + action: string + created_at: string + description: string + field_changed: string | null + id: string + metadata: Json | null + new_value: string | null + old_value: string | null + quote_id: string + user_id: string + } + Insert: { + action: string + created_at?: string + description: string + field_changed?: string | null + id?: string + metadata?: Json | null + new_value?: string | null + old_value?: string | null + quote_id: string + user_id: string + } + Update: { + action?: string + created_at?: string + description?: string + field_changed?: string | null + id?: string + metadata?: Json | null + new_value?: string | null + old_value?: string | null + quote_id?: string + user_id?: string + } + Relationships: [ + { + foreignKeyName: "quote_history_quote_id_fkey" + columns: ["quote_id"] + isOneToOne: false + referencedRelation: "quotes" + referencedColumns: ["id"] + }, + ] + } + quote_item_personalizations: { + Row: { + area_cm2: number | null + colors_count: number + created_at: string + height_cm: number | null + id: string + location_code: string | null + location_name: string | null + notes: string | null + personalized_quantity: number | null + positions_count: number + quote_item_id: string + setup_cost: number + technique_id: string | null + technique_name: string | null + total_cost: number + unit_cost: number + updated_at: string + width_cm: number | null + } + Insert: { + area_cm2?: number | null + colors_count?: number + created_at?: string + height_cm?: number | null + id?: string + location_code?: string | null + location_name?: string | null + notes?: string | null + personalized_quantity?: number | null + positions_count?: number + quote_item_id: string + setup_cost?: number + technique_id?: string | null + technique_name?: string | null + total_cost?: number + unit_cost?: number + updated_at?: string + width_cm?: number | null + } + Update: { + area_cm2?: number | null + colors_count?: number + created_at?: string + height_cm?: number | null + id?: string + location_code?: string | null + location_name?: string | null + notes?: string | null + personalized_quantity?: number | null + positions_count?: number + quote_item_id?: string + setup_cost?: number + technique_id?: string | null + technique_name?: string | null + total_cost?: number + unit_cost?: number + updated_at?: string + width_cm?: number | null + } + Relationships: [ + { + foreignKeyName: "quote_item_personalizations_quote_item_id_fkey" + columns: ["quote_item_id"] + isOneToOne: false + referencedRelation: "quote_items" + referencedColumns: ["id"] + }, + ] + } + quote_items: { + Row: { + artwork_urls: Json | null + bitrix_product_id: string | null + color_hex: string | null + color_name: string | null + created_at: string | null + discount_amount: number | null + discount_percentage: number | null + gender: string | null + has_personalization: boolean | null + id: string + kit_group_id: string | null + kit_name: string | null + mockup_urls: Json | null + notes: string | null + personalization_config: Json | null + personalization_cost: number | null + price_confirmed_at: string | null + price_freshness_threshold_days: number | null + price_updated_at: string | null + product_description: string | null + product_id: string | null + product_image_url: string | null + product_name: string + product_sku: string | null + quantity: number + quote_id: string + size_code: string | null + sort_order: number | null + subtotal: number + unit_price: number + updated_at: string | null + } + Insert: { + artwork_urls?: Json | null + bitrix_product_id?: string | null + color_hex?: string | null + color_name?: string | null + created_at?: string | null + discount_amount?: number | null + discount_percentage?: number | null + gender?: string | null + has_personalization?: boolean | null + id?: string + kit_group_id?: string | null + kit_name?: string | null + mockup_urls?: Json | null + notes?: string | null + personalization_config?: Json | null + personalization_cost?: number | null + price_confirmed_at?: string | null + price_freshness_threshold_days?: number | null + price_updated_at?: string | null + product_description?: string | null + product_id?: string | null + product_image_url?: string | null + product_name: string + product_sku?: string | null + quantity?: number + quote_id: string + size_code?: string | null + sort_order?: number | null + subtotal: number + unit_price: number + updated_at?: string | null + } + Update: { + artwork_urls?: Json | null + bitrix_product_id?: string | null + color_hex?: string | null + color_name?: string | null + created_at?: string | null + discount_amount?: number | null + discount_percentage?: number | null + gender?: string | null + has_personalization?: boolean | null + id?: string + kit_group_id?: string | null + kit_name?: string | null + mockup_urls?: Json | null + notes?: string | null + personalization_config?: Json | null + personalization_cost?: number | null + price_confirmed_at?: string | null + price_freshness_threshold_days?: number | null + price_updated_at?: string | null + product_description?: string | null + product_id?: string | null + product_image_url?: string | null + product_name?: string + product_sku?: string | null + quantity?: number + quote_id?: string + size_code?: string | null + sort_order?: number | null + subtotal?: number + unit_price?: number + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "quote_items_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "quote_items_quote_id_fkey" + columns: ["quote_id"] + isOneToOne: false + referencedRelation: "quotes" + referencedColumns: ["id"] + }, + ] + } + quote_templates: { + Row: { + category: string | null + created_at: string | null + created_by: string | null + delivery_time: string | null + description: string | null + discount_amount: number | null + discount_percent: number | null + id: string + internal_notes: string | null + is_active: boolean | null + is_default: boolean | null + items: Json + name: string + notes: string | null + payment_terms: string | null + seller_id: string | null + template_data: Json | null + updated_at: string | null + usage_count: number | null + validity_days: number | null + } + Insert: { + category?: string | null + created_at?: string | null + created_by?: string | null + delivery_time?: string | null + description?: string | null + discount_amount?: number | null + discount_percent?: number | null + id?: string + internal_notes?: string | null + is_active?: boolean | null + is_default?: boolean | null + items?: Json + name: string + notes?: string | null + payment_terms?: string | null + seller_id?: string | null + template_data?: Json | null + updated_at?: string | null + usage_count?: number | null + validity_days?: number | null + } + Update: { + category?: string | null + created_at?: string | null + created_by?: string | null + delivery_time?: string | null + description?: string | null + discount_amount?: number | null + discount_percent?: number | null + id?: string + internal_notes?: string | null + is_active?: boolean | null + is_default?: boolean | null + items?: Json + name?: string + notes?: string | null + payment_terms?: string | null + seller_id?: string | null + template_data?: Json | null + updated_at?: string | null + usage_count?: number | null + validity_days?: number | null + } + Relationships: [] + } + quote_versions: { + Row: { + change_summary: string | null + created_at: string | null + created_by: string | null + id: string + quote_id: string + snapshot: Json + version_number: number + } + Insert: { + change_summary?: string | null + created_at?: string | null + created_by?: string | null + id?: string + quote_id: string + snapshot: Json + version_number: number + } + Update: { + change_summary?: string | null + created_at?: string | null + created_by?: string | null + id?: string + quote_id?: string + snapshot?: Json + version_number?: number + } + Relationships: [ + { + foreignKeyName: "quote_versions_quote_id_fkey" + columns: ["quote_id"] + isOneToOne: false + referencedRelation: "quotes" + referencedColumns: ["id"] + }, + ] + } + quotes: { + Row: { + approval_token: string | null + approved_at: string | null + approved_by_client_name: string | null + assigned_to: string | null + bitrix_deal_id: string | null + bitrix_quote_id: string | null + client_cnpj: string | null + client_company: string | null + client_email: string | null + client_feedback: string | null + client_id: string | null + client_name: string + client_phone: string | null + client_response: string | null + client_response_at: string | null + client_response_notes: string | null + conversion_notes: string | null + converted_at: string | null + converted_to_order_id: string | null + created_at: string | null + created_by: string | null + delivery_time: string | null + discount_amount: number | null + discount_percent: number | null + estimated_delivery_days: number | null + id: string + internal_notes: string | null + is_latest_version: boolean + last_sent_at: string | null + negotiation_markup_percent: number | null + notes: string | null + organization_id: string | null + parent_quote_id: string | null + payment_method: string | null + payment_terms: string | null + priority: string | null + quote_number: string + real_discount_percent: number | null + real_subtotal: number | null + seller_id: string | null + sent_at: string | null + shipping_cost: number | null + shipping_method: string | null + shipping_type: string | null + stage: string | null + status: string | null + subtotal: number | null + synced_at: string | null + synced_to_bitrix: boolean | null + tags: Json | null + tax_amount: number | null + total: number | null + updated_at: string | null + valid_until: string | null + version: number + view_count: number | null + viewed_at: string | null + } + Insert: { + approval_token?: string | null + approved_at?: string | null + approved_by_client_name?: string | null + assigned_to?: string | null + bitrix_deal_id?: string | null + bitrix_quote_id?: string | null + client_cnpj?: string | null + client_company?: string | null + client_email?: string | null + client_feedback?: string | null + client_id?: string | null + client_name: string + client_phone?: string | null + client_response?: string | null + client_response_at?: string | null + client_response_notes?: string | null + conversion_notes?: string | null + converted_at?: string | null + converted_to_order_id?: string | null + created_at?: string | null + created_by?: string | null + delivery_time?: string | null + discount_amount?: number | null + discount_percent?: number | null + estimated_delivery_days?: number | null + id?: string + internal_notes?: string | null + is_latest_version?: boolean + last_sent_at?: string | null + negotiation_markup_percent?: number | null + notes?: string | null + organization_id?: string | null + parent_quote_id?: string | null + payment_method?: string | null + payment_terms?: string | null + priority?: string | null + quote_number: string + real_discount_percent?: number | null + real_subtotal?: number | null + seller_id?: string | null + sent_at?: string | null + shipping_cost?: number | null + shipping_method?: string | null + shipping_type?: string | null + stage?: string | null + status?: string | null + subtotal?: number | null + synced_at?: string | null + synced_to_bitrix?: boolean | null + tags?: Json | null + tax_amount?: number | null + total?: number | null + updated_at?: string | null + valid_until?: string | null + version?: number + view_count?: number | null + viewed_at?: string | null + } + Update: { + approval_token?: string | null + approved_at?: string | null + approved_by_client_name?: string | null + assigned_to?: string | null + bitrix_deal_id?: string | null + bitrix_quote_id?: string | null + client_cnpj?: string | null + client_company?: string | null + client_email?: string | null + client_feedback?: string | null + client_id?: string | null + client_name?: string + client_phone?: string | null + client_response?: string | null + client_response_at?: string | null + client_response_notes?: string | null + conversion_notes?: string | null + converted_at?: string | null + converted_to_order_id?: string | null + created_at?: string | null + created_by?: string | null + delivery_time?: string | null + discount_amount?: number | null + discount_percent?: number | null + estimated_delivery_days?: number | null + id?: string + internal_notes?: string | null + is_latest_version?: boolean + last_sent_at?: string | null + negotiation_markup_percent?: number | null + notes?: string | null + organization_id?: string | null + parent_quote_id?: string | null + payment_method?: string | null + payment_terms?: string | null + priority?: string | null + quote_number?: string + real_discount_percent?: number | null + real_subtotal?: number | null + seller_id?: string | null + sent_at?: string | null + shipping_cost?: number | null + shipping_method?: string | null + shipping_type?: string | null + stage?: string | null + status?: string | null + subtotal?: number | null + synced_at?: string | null + synced_to_bitrix?: boolean | null + tags?: Json | null + tax_amount?: number | null + total?: number | null + updated_at?: string | null + valid_until?: string | null + version?: number + view_count?: number | null + viewed_at?: string | null + } + Relationships: [ + { + foreignKeyName: "quotes_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "quotes_parent_quote_id_fkey" + columns: ["parent_quote_id"] + isOneToOne: false + referencedRelation: "quotes" + referencedColumns: ["id"] + }, + ] + } + ramo_atividade: { + Row: { + ativo: boolean | null + cor: string | null + created_at: string | null + descricao: string | null + icone: string | null + id: string + nome: string + ordem: number | null + slug: string + updated_at: string | null + } + Insert: { + ativo?: boolean | null + cor?: string | null + created_at?: string | null + descricao?: string | null + icone?: string | null + id?: string + nome: string + ordem?: number | null + slug: string + updated_at?: string | null + } + Update: { + ativo?: boolean | null + cor?: string | null + created_at?: string | null + descricao?: string | null + icone?: string | null + id?: string + nome?: string + ordem?: number | null + slug?: string + updated_at?: string | null + } + Relationships: [] + } + ramo_atividade_filho: { + Row: { + ativo: boolean | null + created_at: string | null + descricao: string | null + icone: string | null + id: string + nome: string + ordem: number | null + ramo_atividade_id: string + slug: string + updated_at: string | null + } + Insert: { + ativo?: boolean | null + created_at?: string | null + descricao?: string | null + icone?: string | null + id?: string + nome: string + ordem?: number | null + ramo_atividade_id: string + slug: string + updated_at?: string | null + } + Update: { + ativo?: boolean | null + created_at?: string | null + descricao?: string | null + icone?: string | null + id?: string + nome?: string + ordem?: number | null + ramo_atividade_id?: string + slug?: string + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "ramo_atividade_filho_ramo_atividade_id_fkey" + columns: ["ramo_atividade_id"] + isOneToOne: false + referencedRelation: "ramo_atividade" + referencedColumns: ["id"] + }, + ] + } + recently_viewed_products: { + Row: { + id: string + product_id: string + user_id: string + viewed_at: string + } + Insert: { + id?: string + product_id: string + user_id: string + viewed_at?: string + } + Update: { + id?: string + product_id?: string + user_id?: string + viewed_at?: string + } + Relationships: [] + } + request_rate_limits: { + Row: { + blocked_until: string | null + created_at: string + endpoint: string + id: string + identifier: string + request_count: number + updated_at: string + window_start: string + } + Insert: { + blocked_until?: string | null + created_at?: string + endpoint: string + id?: string + identifier: string + request_count?: number + updated_at?: string + window_start?: string + } + Update: { + blocked_until?: string | null + created_at?: string + endpoint?: string + id?: string + identifier?: string + request_count?: number + updated_at?: string + window_start?: string + } + Relationships: [] + } + rls_denial_log: { + Row: { + created_at: string + endpoint: string | null + error_code: string | null + error_message: string | null + id: string + ip_address: unknown + operation: string + policy_hint: string | null + query_summary: string | null + table_name: string + target_id: string | null + target_seller_id: string | null + user_agent: string | null + user_email: string | null + user_id: string + user_role: string | null + } + Insert: { + created_at?: string + endpoint?: string | null + error_code?: string | null + error_message?: string | null + id?: string + ip_address?: unknown + operation: string + policy_hint?: string | null + query_summary?: string | null + table_name: string + target_id?: string | null + target_seller_id?: string | null + user_agent?: string | null + user_email?: string | null + user_id: string + user_role?: string | null + } + Update: { + created_at?: string + endpoint?: string | null + error_code?: string | null + error_message?: string | null + id?: string + ip_address?: unknown + operation?: string + policy_hint?: string | null + query_summary?: string | null + table_name?: string + target_id?: string | null + target_seller_id?: string | null + user_agent?: string | null + user_email?: string | null + user_id?: string + user_role?: string | null + } + Relationships: [] + } + role_migration_batches: { + Row: { + created_at: string + dry_run: boolean + duration_ms: number | null + failed_count: number + finished_at: string | null + id: string + initiated_by: string + label: string + reason: string + skipped_count: number + started_at: string | null + status: Database["public"]["Enums"]["role_migration_status"] + success_count: number + total_items: number + } + Insert: { + created_at?: string + dry_run?: boolean + duration_ms?: number | null + failed_count?: number + finished_at?: string | null + id?: string + initiated_by: string + label: string + reason: string + skipped_count?: number + started_at?: string | null + status?: Database["public"]["Enums"]["role_migration_status"] + success_count?: number + total_items?: number + } + Update: { + created_at?: string + dry_run?: boolean + duration_ms?: number | null + failed_count?: number + finished_at?: string | null + id?: string + initiated_by?: string + label?: string + reason?: string + skipped_count?: number + started_at?: string | null + status?: Database["public"]["Enums"]["role_migration_status"] + success_count?: number + total_items?: number + } + Relationships: [] + } + role_migration_items: { + Row: { + batch_id: string + created_at: string + duration_ms: number | null + error_message: string | null + from_role: Database["public"]["Enums"]["app_role"] | null + id: string + operation: string + processed_at: string | null + status: Database["public"]["Enums"]["role_migration_item_status"] + to_role: Database["public"]["Enums"]["app_role"] + user_email: string | null + user_id: string + } + Insert: { + batch_id: string + created_at?: string + duration_ms?: number | null + error_message?: string | null + from_role?: Database["public"]["Enums"]["app_role"] | null + id?: string + operation: string + processed_at?: string | null + status?: Database["public"]["Enums"]["role_migration_item_status"] + to_role: Database["public"]["Enums"]["app_role"] + user_email?: string | null + user_id: string + } + Update: { + batch_id?: string + created_at?: string + duration_ms?: number | null + error_message?: string | null + from_role?: Database["public"]["Enums"]["app_role"] | null + id?: string + operation?: string + processed_at?: string | null + status?: Database["public"]["Enums"]["role_migration_item_status"] + to_role?: Database["public"]["Enums"]["app_role"] + user_email?: string | null + user_id?: string + } + Relationships: [] + } + role_permissions: { + Row: { + created_at: string + id: string + permission_code: string + role: Database["public"]["Enums"]["app_role"] + } + Insert: { + created_at?: string + id?: string + permission_code: string + role: Database["public"]["Enums"]["app_role"] + } + Update: { + created_at?: string + id?: string + permission_code?: string + role?: Database["public"]["Enums"]["app_role"] + } + Relationships: [ + { + foreignKeyName: "role_permissions_permission_code_fkey" + columns: ["permission_code"] + isOneToOne: false + referencedRelation: "permissions" + referencedColumns: ["code"] + }, + ] + } + roles: { + Row: { + created_at: string + description: string | null + id: string + name: string + } + Insert: { + created_at?: string + description?: string | null + id?: string + name: string + } + Update: { + created_at?: string + description?: string | null + id?: string + name?: string + } + Relationships: [] + } + sales_goals: { + Row: { + achieved_at: string | null + created_at: string + current_conversions: number + current_quotes: number + current_value: number + end_date: string + goal_type: string + id: string + is_achieved: boolean + start_date: string + target_conversions: number + target_quotes: number + target_value: number + updated_at: string + user_id: string + } + Insert: { + achieved_at?: string | null + created_at?: string + current_conversions?: number + current_quotes?: number + current_value?: number + end_date: string + goal_type: string + id?: string + is_achieved?: boolean + start_date: string + target_conversions?: number + target_quotes?: number + target_value?: number + updated_at?: string + user_id: string + } + Update: { + achieved_at?: string | null + created_at?: string + current_conversions?: number + current_quotes?: number + current_value?: number + end_date?: string + goal_type?: string + id?: string + is_achieved?: boolean + start_date?: string + target_conversions?: number + target_quotes?: number + target_value?: number + updated_at?: string + user_id?: string + } + Relationships: [] + } + saved_filters: { + Row: { + category: string | null + color: string | null + created_at: string | null + description: string | null + filter_config: Json + icon: string | null + id: string + is_default: boolean | null + name: string + updated_at: string | null + user_id: string + } + Insert: { + category?: string | null + color?: string | null + created_at?: string | null + description?: string | null + filter_config: Json + icon?: string | null + id?: string + is_default?: boolean | null + name: string + updated_at?: string | null + user_id: string + } + Update: { + category?: string | null + color?: string | null + created_at?: string | null + description?: string | null + filter_config?: Json + icon?: string | null + id?: string + is_default?: boolean | null + name?: string + updated_at?: string | null + user_id?: string + } + Relationships: [] + } + saved_trends_views: { + Row: { + created_at: string + filters: Json + id: string + name: string + updated_at: string + user_id: string + } + Insert: { + created_at?: string + filters?: Json + id?: string + name: string + updated_at?: string + user_id: string + } + Update: { + created_at?: string + filters?: Json + id?: string + name?: string + updated_at?: string + user_id?: string + } + Relationships: [] + } + scheduled_reports: { + Row: { + created_at: string + email_to: string + filters: Json | null + frequency: string + id: string + is_active: boolean + last_sent_at: string | null + next_run_at: string + report_name: string + report_type: string + updated_at: string + user_id: string + } + Insert: { + created_at?: string + email_to: string + filters?: Json | null + frequency?: string + id?: string + is_active?: boolean + last_sent_at?: string | null + next_run_at?: string + report_name?: string + report_type?: string + updated_at?: string + user_id: string + } + Update: { + created_at?: string + email_to?: string + filters?: Json | null + frequency?: string + id?: string + is_active?: boolean + last_sent_at?: string | null + next_run_at?: string + report_name?: string + report_type?: string + updated_at?: string + user_id?: string + } + Relationships: [] + } + schema_drift_allowlist: { + Row: { + added_at: string + added_by: string + metadata: Json | null + reason: string + table_name: string + } + Insert: { + added_at?: string + added_by: string + metadata?: Json | null + reason: string + table_name: string + } + Update: { + added_at?: string + added_by?: string + metadata?: Json | null + reason?: string + table_name?: string + } + Relationships: [] + } + schema_drift_log: { + Row: { + error_message: string | null + has_drift: boolean + id: string + notification_sent: boolean | null + only_lovable: string[] | null + only_oficial: string[] | null + ran_at: string + schema_diff: Json | null + tables_lovable: number + tables_oficial: number + } + Insert: { + error_message?: string | null + has_drift: boolean + id?: string + notification_sent?: boolean | null + only_lovable?: string[] | null + only_oficial?: string[] | null + ran_at?: string + schema_diff?: Json | null + tables_lovable: number + tables_oficial: number + } + Update: { + error_message?: string | null + has_drift?: boolean + id?: string + notification_sent?: boolean | null + only_lovable?: string[] | null + only_oficial?: string[] | null + ran_at?: string + schema_diff?: Json | null + tables_lovable?: number + tables_oficial?: number + } + Relationships: [] + } + scraper_checkpoints: { + Row: { + checkpoint_name: string + completed_at: string | null + created_at: string | null + error_records: number | null + id: string + metrics: Json | null + notes: string | null + phase: string + processed_records: number | null + started_at: string | null + status: string + total_records: number | null + } + Insert: { + checkpoint_name: string + completed_at?: string | null + created_at?: string | null + error_records?: number | null + id?: string + metrics?: Json | null + notes?: string | null + phase: string + processed_records?: number | null + started_at?: string | null + status?: string + total_records?: number | null + } + Update: { + checkpoint_name?: string + completed_at?: string | null + created_at?: string | null + error_records?: number | null + id?: string + metrics?: Json | null + notes?: string | null + phase?: string + processed_records?: number | null + started_at?: string | null + status?: string + total_records?: number | null + } + Relationships: [] + } + scraper_images_staging: { + Row: { + batch_id: string | null + checkpoint: string | null + cloudflare_image_id: string | null + color_code_detected: string | null + color_id: string | null + created_at: string | null + error_message: string | null + exists_in_db: boolean | null + id: string + image_alt: string | null + image_name: string | null + image_position: number | null + image_src: string + image_type_detected: string | null + is_duplicate: boolean | null + processed_at: string | null + product_id: string | null + retry_count: number | null + sha256_hash: string | null + sku: string + status: string + supplier_id: string + updated_at: string | null + url_cdn: string | null + woo_image_id: number | null + woo_product_id: number | null + } + Insert: { + batch_id?: string | null + checkpoint?: string | null + cloudflare_image_id?: string | null + color_code_detected?: string | null + color_id?: string | null + created_at?: string | null + error_message?: string | null + exists_in_db?: boolean | null + id?: string + image_alt?: string | null + image_name?: string | null + image_position?: number | null + image_src: string + image_type_detected?: string | null + is_duplicate?: boolean | null + processed_at?: string | null + product_id?: string | null + retry_count?: number | null + sha256_hash?: string | null + sku: string + status?: string + supplier_id?: string + updated_at?: string | null + url_cdn?: string | null + woo_image_id?: number | null + woo_product_id?: number | null + } + Update: { + batch_id?: string | null + checkpoint?: string | null + cloudflare_image_id?: string | null + color_code_detected?: string | null + color_id?: string | null + created_at?: string | null + error_message?: string | null + exists_in_db?: boolean | null + id?: string + image_alt?: string | null + image_name?: string | null + image_position?: number | null + image_src?: string + image_type_detected?: string | null + is_duplicate?: boolean | null + processed_at?: string | null + product_id?: string | null + retry_count?: number | null + sha256_hash?: string | null + sku?: string + status?: string + supplier_id?: string + updated_at?: string | null + url_cdn?: string | null + woo_image_id?: number | null + woo_product_id?: number | null + } + Relationships: [ + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "scraper_images_staging_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + search_analytics: { + Row: { + created_at: string + id: string + results_count: number + search_context: string | null + search_term: string + user_id: string | null + } + Insert: { + created_at?: string + id?: string + results_count?: number + search_context?: string | null + search_term: string + user_id?: string | null + } + Update: { + created_at?: string + id?: string + results_count?: number + search_context?: string | null + search_term?: string + user_id?: string | null + } + Relationships: [] + } + search_queries: { + Row: { + clicked_product_id: string | null + created_at: string | null + filters_applied: Json | null + id: string + query: string + results_count: number | null + user_id: string | null + } + Insert: { + clicked_product_id?: string | null + created_at?: string | null + filters_applied?: Json | null + id?: string + query: string + results_count?: number | null + user_id?: string | null + } + Update: { + clicked_product_id?: string | null + created_at?: string | null + filters_applied?: Json | null + id?: string + query?: string + results_count?: number | null + user_id?: string | null + } + Relationships: [ + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "search_queries_clicked_product_id_fkey" + columns: ["clicked_product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + secret_rotation_log: { + Row: { + action_type: string + id: string + new_suffix: string | null + notes: string | null + previous_suffix: string | null + rotated_at: string + rotated_by: string | null + secret_name: string + } + Insert: { + action_type: string + id?: string + new_suffix?: string | null + notes?: string | null + previous_suffix?: string | null + rotated_at?: string + rotated_by?: string | null + secret_name: string + } + Update: { + action_type?: string + id?: string + new_suffix?: string | null + notes?: string | null + previous_suffix?: string | null + rotated_at?: string + rotated_by?: string | null + secret_name?: string + } + Relationships: [] + } + security_settings: { + Row: { + created_at: string + description: string | null + setting_key: string + setting_value: Json + updated_at: string + updated_by: string | null + } + Insert: { + created_at?: string + description?: string | null + setting_key: string + setting_value?: Json + updated_at?: string + updated_by?: string | null + } + Update: { + created_at?: string + description?: string | null + setting_key?: string + setting_value?: Json + updated_at?: string + updated_by?: string | null + } + Relationships: [] + } + seller_cart_items: { + Row: { + cart_id: string + color_hex: string | null + color_name: string | null + created_at: string + id: string + notes: string | null + product_id: string + product_image_url: string | null + product_name: string + product_price: number + product_sku: string | null + quantity: number + sort_order: number | null + updated_at: string + } + Insert: { + cart_id: string + color_hex?: string | null + color_name?: string | null + created_at?: string + id?: string + notes?: string | null + product_id: string + product_image_url?: string | null + product_name: string + product_price?: number + product_sku?: string | null + quantity?: number + sort_order?: number | null + updated_at?: string + } + Update: { + cart_id?: string + color_hex?: string | null + color_name?: string | null + created_at?: string + id?: string + notes?: string | null + product_id?: string + product_image_url?: string | null + product_name?: string + product_price?: number + product_sku?: string | null + quantity?: number + sort_order?: number | null + updated_at?: string + } + Relationships: [] + } + seller_carts: { + Row: { + company_id: string + company_location: string | null + company_logo_url: string | null + company_name: string + created_at: string + id: string + notes: string | null + seller_id: string + status: string + updated_at: string + } + Insert: { + company_id: string + company_location?: string | null + company_logo_url?: string | null + company_name: string + created_at?: string + id?: string + notes?: string | null + seller_id: string + status?: string + updated_at?: string + } + Update: { + company_id?: string + company_location?: string | null + company_logo_url?: string | null + company_name?: string + created_at?: string + id?: string + notes?: string | null + seller_id?: string + status?: string + updated_at?: string + } + Relationships: [] + } + seller_discount_limits: { + Row: { + approval_required_above: number | null + created_at: string + id: string + max_discount_percent: number + notes: string | null + set_by: string | null + updated_at: string + user_id: string + } + Insert: { + approval_required_above?: number | null + created_at?: string + id?: string + max_discount_percent?: number + notes?: string | null + set_by?: string | null + updated_at?: string + user_id: string + } + Update: { + approval_required_above?: number | null + created_at?: string + id?: string + max_discount_percent?: number + notes?: string | null + set_by?: string | null + updated_at?: string + user_id?: string + } + Relationships: [] + } + seo_audit_log: { + Row: { + audit_trigger: string | null + audited_at: string | null + entity_id: string + entity_type: string + id: string + issues: Json | null + meta_snapshot: Json | null + passed_checks: Json | null + previous_score: number | null + seo_score: number + suggestions: Json | null + warnings: Json | null + } + Insert: { + audit_trigger?: string | null + audited_at?: string | null + entity_id: string + entity_type: string + id?: string + issues?: Json | null + meta_snapshot?: Json | null + passed_checks?: Json | null + previous_score?: number | null + seo_score: number + suggestions?: Json | null + warnings?: Json | null + } + Update: { + audit_trigger?: string | null + audited_at?: string | null + entity_id?: string + entity_type?: string + id?: string + issues?: Json | null + meta_snapshot?: Json | null + passed_checks?: Json | null + previous_score?: number | null + seo_score?: number + suggestions?: Json | null + warnings?: Json | null + } + Relationships: [] + } + seo_redirects: { + Row: { + created_at: string | null + created_by: string | null + expires_at: string | null + hit_count: number | null + id: string + is_active: boolean | null + is_regex: boolean | null + last_hit_at: string | null + reason: string | null + redirect_type: number + source_path: string + target_path: string + } + Insert: { + created_at?: string | null + created_by?: string | null + expires_at?: string | null + hit_count?: number | null + id?: string + is_active?: boolean | null + is_regex?: boolean | null + last_hit_at?: string | null + reason?: string | null + redirect_type?: number + source_path: string + target_path: string + } + Update: { + created_at?: string | null + created_by?: string | null + expires_at?: string | null + hit_count?: number | null + id?: string + is_active?: boolean | null + is_regex?: boolean | null + last_hit_at?: string | null + reason?: string | null + redirect_type?: number + source_path?: string + target_path?: string + } + Relationships: [] + } + simulator_wizard_drafts: { + Row: { + created_at: string + id: string + personalizations: Json + product_data: Json + quantity: number + title: string + updated_at: string + user_id: string + wizard_step: string + } + Insert: { + created_at?: string + id?: string + personalizations?: Json + product_data?: Json + quantity?: number + title?: string + updated_at?: string + user_id: string + wizard_step?: string + } + Update: { + created_at?: string + id?: string + personalizations?: Json + product_data?: Json + quantity?: number + title?: string + updated_at?: string + user_id?: string + wizard_step?: string + } + Relationships: [] + } + sm_images_staging: { + Row: { + cloudflare_image_id: string | null + cloudflare_url: string | null + created_at: string | null + display_order: number | null + error_message: string | null + id: string + image_id_site: number | null + image_slug: string | null + image_type: string | null + is_primary: boolean | null + partition_id: number | null + populated_at: string | null + product_id: string | null + product_image_id: string | null + retry_count: number | null + sku: string + source: string + source_url: string + status: string | null + supplier_id: string | null + updated_at: string | null + uploaded_at: string | null + variant_id: string | null + } + Insert: { + cloudflare_image_id?: string | null + cloudflare_url?: string | null + created_at?: string | null + display_order?: number | null + error_message?: string | null + id?: string + image_id_site?: number | null + image_slug?: string | null + image_type?: string | null + is_primary?: boolean | null + partition_id?: number | null + populated_at?: string | null + product_id?: string | null + product_image_id?: string | null + retry_count?: number | null + sku: string + source?: string + source_url: string + status?: string | null + supplier_id?: string | null + updated_at?: string | null + uploaded_at?: string | null + variant_id?: string | null + } + Update: { + cloudflare_image_id?: string | null + cloudflare_url?: string | null + created_at?: string | null + display_order?: number | null + error_message?: string | null + id?: string + image_id_site?: number | null + image_slug?: string | null + image_type?: string | null + is_primary?: boolean | null + partition_id?: number | null + populated_at?: string | null + product_id?: string | null + product_image_id?: string | null + retry_count?: number | null + sku?: string + source?: string + source_url?: string + status?: string | null + supplier_id?: string | null + updated_at?: string | null + uploaded_at?: string | null + variant_id?: string | null + } + Relationships: [] + } + sm_worker_partitions: { + Row: { + completed_at: string | null + created_at: string | null + id: number + invocation_count: number | null + last_invocation_at: string | null + started_at: string | null + status: string | null + total_errors: number | null + total_images: number | null + total_skus: number | null + total_uploaded: number | null + worker_id: number + } + Insert: { + completed_at?: string | null + created_at?: string | null + id?: number + invocation_count?: number | null + last_invocation_at?: string | null + started_at?: string | null + status?: string | null + total_errors?: number | null + total_images?: number | null + total_skus?: number | null + total_uploaded?: number | null + worker_id: number + } + Update: { + completed_at?: string | null + created_at?: string | null + id?: number + invocation_count?: number | null + last_invocation_at?: string | null + started_at?: string | null + status?: string | null + total_errors?: number | null + total_images?: number | null + total_skus?: number | null + total_uploaded?: number | null + worker_id?: number + } + Relationships: [] + } + step_up_audit_log: { + Row: { + action: Database["public"]["Enums"]["step_up_action"] | null + challenge_id: string | null + created_at: string + event_type: string + id: string + ip_address: unknown + metadata: Json | null + target_ref: string | null + token_id: string | null + user_agent: string | null + user_id: string | null + } + Insert: { + action?: Database["public"]["Enums"]["step_up_action"] | null + challenge_id?: string | null + created_at?: string + event_type: string + id?: string + ip_address?: unknown + metadata?: Json | null + target_ref?: string | null + token_id?: string | null + user_agent?: string | null + user_id?: string | null + } + Update: { + action?: Database["public"]["Enums"]["step_up_action"] | null + challenge_id?: string | null + created_at?: string + event_type?: string + id?: string + ip_address?: unknown + metadata?: Json | null + target_ref?: string | null + token_id?: string | null + user_agent?: string | null + user_id?: string | null + } + Relationships: [] + } + step_up_challenges: { + Row: { + action: Database["public"]["Enums"]["step_up_action"] + attempts: number + consumed: boolean + created_at: string + expires_at: string + id: string + ip_address: unknown + max_attempts: number + otp_hash: string + otp_verified: boolean + password_verified: boolean + target_ref: string | null + user_agent: string | null + user_id: string + } + Insert: { + action: Database["public"]["Enums"]["step_up_action"] + attempts?: number + consumed?: boolean + created_at?: string + expires_at?: string + id?: string + ip_address?: unknown + max_attempts?: number + otp_hash: string + otp_verified?: boolean + password_verified?: boolean + target_ref?: string | null + user_agent?: string | null + user_id: string + } + Update: { + action?: Database["public"]["Enums"]["step_up_action"] + attempts?: number + consumed?: boolean + created_at?: string + expires_at?: string + id?: string + ip_address?: unknown + max_attempts?: number + otp_hash?: string + otp_verified?: boolean + password_verified?: boolean + target_ref?: string | null + user_agent?: string | null + user_id?: string + } + Relationships: [] + } + step_up_tokens: { + Row: { + action: Database["public"]["Enums"]["step_up_action"] + challenge_id: string + consumed: boolean + consumed_at: string | null + created_at: string + expires_at: string + id: string + target_ref: string | null + token_hash: string + user_id: string + } + Insert: { + action: Database["public"]["Enums"]["step_up_action"] + challenge_id: string + consumed?: boolean + consumed_at?: string | null + created_at?: string + expires_at?: string + id?: string + target_ref?: string | null + token_hash: string + user_id: string + } + Update: { + action?: Database["public"]["Enums"]["step_up_action"] + challenge_id?: string + consumed?: boolean + consumed_at?: string | null + created_at?: string + expires_at?: string + id?: string + target_ref?: string | null + token_hash?: string + user_id?: string + } + Relationships: [] + } + stock_daily_summary: { + Row: { + cost_price_close: number | null + cost_price_open: number | null + created_at: string + id: number + net_change: number | null + price_changed: boolean | null + product_id: string + restock_count: number | null + restock_detected: boolean | null + restock_quantity: number | null + stock_close: number | null + stock_max: number | null + stock_min: number | null + stock_open: number | null + summary_date: string + supplier_branch_id: string | null + supplier_id: string + sync_count: number | null + units_depleted: number | null + units_restocked: number | null + variant_id: string + variant_supplier_source_id: string + } + Insert: { + cost_price_close?: number | null + cost_price_open?: number | null + created_at?: string + id?: never + net_change?: number | null + price_changed?: boolean | null + product_id: string + restock_count?: number | null + restock_detected?: boolean | null + restock_quantity?: number | null + stock_close?: number | null + stock_max?: number | null + stock_min?: number | null + stock_open?: number | null + summary_date: string + supplier_branch_id?: string | null + supplier_id: string + sync_count?: number | null + units_depleted?: number | null + units_restocked?: number | null + variant_id: string + variant_supplier_source_id: string + } + Update: { + cost_price_close?: number | null + cost_price_open?: number | null + created_at?: string + id?: never + net_change?: number | null + price_changed?: boolean | null + product_id?: string + restock_count?: number | null + restock_detected?: boolean | null + restock_quantity?: number | null + stock_close?: number | null + stock_max?: number | null + stock_min?: number | null + stock_open?: number | null + summary_date?: string + supplier_branch_id?: string | null + supplier_id?: string + sync_count?: number | null + units_depleted?: number | null + units_restocked?: number | null + variant_id?: string + variant_supplier_source_id?: string + } + Relationships: [ + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_daily_summary_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_daily_summary_supplier_branch_id_fkey" + columns: ["supplier_branch_id"] + isOneToOne: false + referencedRelation: "supplier_branches" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_daily_summary_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_daily_summary_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "stock_daily_summary_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "stock_daily_summary_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "stock_daily_summary_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "product_variants" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_daily_summary_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "stock_daily_summary_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "stock_daily_summary_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_variant_sale_prices" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "stock_daily_summary_variant_supplier_source_id_fkey" + columns: ["variant_supplier_source_id"] + isOneToOne: false + referencedRelation: "variant_supplier_sources" + referencedColumns: ["id"] + }, + ] + } + stock_snapshots: { + Row: { + captured_at: string + change_type: string + cost_price_delta: number | null + cost_price_new: number | null + cost_price_old: number | null + id: number + product_id: string + stock_main_delta: number | null + stock_main_new: number | null + stock_main_old: number | null + stock_other_delta: number | null + stock_other_new: number | null + stock_other_old: number | null + stock_total_new: number | null + stock_total_old: number | null + supplier_branch_id: string | null + supplier_id: string + sync_source: string | null + variant_id: string + variant_supplier_source_id: string + } + Insert: { + captured_at?: string + change_type?: string + cost_price_delta?: number | null + cost_price_new?: number | null + cost_price_old?: number | null + id?: never + product_id: string + stock_main_delta?: number | null + stock_main_new?: number | null + stock_main_old?: number | null + stock_other_delta?: number | null + stock_other_new?: number | null + stock_other_old?: number | null + stock_total_new?: number | null + stock_total_old?: number | null + supplier_branch_id?: string | null + supplier_id: string + sync_source?: string | null + variant_id: string + variant_supplier_source_id: string + } + Update: { + captured_at?: string + change_type?: string + cost_price_delta?: number | null + cost_price_new?: number | null + cost_price_old?: number | null + id?: never + product_id?: string + stock_main_delta?: number | null + stock_main_new?: number | null + stock_main_old?: number | null + stock_other_delta?: number | null + stock_other_new?: number | null + stock_other_old?: number | null + stock_total_new?: number | null + stock_total_old?: number | null + supplier_branch_id?: string | null + supplier_id?: string + sync_source?: string | null + variant_id?: string + variant_supplier_source_id?: string + } + Relationships: [ + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_snapshots_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_snapshots_supplier_branch_id_fkey" + columns: ["supplier_branch_id"] + isOneToOne: false + referencedRelation: "supplier_branches" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_snapshots_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_snapshots_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "stock_snapshots_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "stock_snapshots_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "stock_snapshots_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "product_variants" + referencedColumns: ["id"] + }, + { + foreignKeyName: "stock_snapshots_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "stock_snapshots_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "stock_snapshots_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_variant_sale_prices" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "stock_snapshots_variant_supplier_source_id_fkey" + columns: ["variant_supplier_source_id"] + isOneToOne: false + referencedRelation: "variant_supplier_sources" + referencedColumns: ["id"] + }, + ] + } + supplier_attribute_definitions: { + Row: { + api_attribute_key: string + api_attribute_name: string | null + api_attribute_name_original: string | null + api_description: string | null + api_raw_data: Json | null + api_unit: string | null + created_at: string | null + data_type: string | null + id: string + is_active: boolean | null + is_mapped: boolean | null + notes: string | null + organization_id: string + sample_values: Json | null + source: string | null + supplier_id: string + updated_at: string | null + value_count: number | null + } + Insert: { + api_attribute_key: string + api_attribute_name?: string | null + api_attribute_name_original?: string | null + api_description?: string | null + api_raw_data?: Json | null + api_unit?: string | null + created_at?: string | null + data_type?: string | null + id?: string + is_active?: boolean | null + is_mapped?: boolean | null + notes?: string | null + organization_id: string + sample_values?: Json | null + source?: string | null + supplier_id: string + updated_at?: string | null + value_count?: number | null + } + Update: { + api_attribute_key?: string + api_attribute_name?: string | null + api_attribute_name_original?: string | null + api_description?: string | null + api_raw_data?: Json | null + api_unit?: string | null + created_at?: string | null + data_type?: string | null + id?: string + is_active?: boolean | null + is_mapped?: boolean | null + notes?: string | null + organization_id?: string + sample_values?: Json | null + source?: string | null + supplier_id?: string + updated_at?: string | null + value_count?: number | null + } + Relationships: [ + { + foreignKeyName: "supplier_attribute_definitions_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_attribute_definitions_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_attribute_definitions_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_attribute_definitions_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_attribute_definitions_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + supplier_branches: { + Row: { + address: string | null + branch_code: string | null + branch_name: string + city: string | null + cnpj: string | null + created_at: string | null + default_cest: string | null + default_cfop_internal: string | null + default_cfop_interstate: string | null + default_cofins_rate: number | null + default_csosn: string | null + default_cst: string | null + default_operation_nature: string | null + default_pis_rate: number | null + icms_internal_rate: number | null + icms_interstate_rate: number | null + id: string + inscricao_estadual: string | null + is_active: boolean | null + is_default: boolean | null + notes: string | null + state_uf: string + supplier_id: string + tax_regime: string | null + updated_at: string | null + } + Insert: { + address?: string | null + branch_code?: string | null + branch_name: string + city?: string | null + cnpj?: string | null + created_at?: string | null + default_cest?: string | null + default_cfop_internal?: string | null + default_cfop_interstate?: string | null + default_cofins_rate?: number | null + default_csosn?: string | null + default_cst?: string | null + default_operation_nature?: string | null + default_pis_rate?: number | null + icms_internal_rate?: number | null + icms_interstate_rate?: number | null + id?: string + inscricao_estadual?: string | null + is_active?: boolean | null + is_default?: boolean | null + notes?: string | null + state_uf: string + supplier_id: string + tax_regime?: string | null + updated_at?: string | null + } + Update: { + address?: string | null + branch_code?: string | null + branch_name?: string + city?: string | null + cnpj?: string | null + created_at?: string | null + default_cest?: string | null + default_cfop_internal?: string | null + default_cfop_interstate?: string | null + default_cofins_rate?: number | null + default_csosn?: string | null + default_cst?: string | null + default_operation_nature?: string | null + default_pis_rate?: number | null + icms_internal_rate?: number | null + icms_interstate_rate?: number | null + id?: string + inscricao_estadual?: string | null + is_active?: boolean | null + is_default?: boolean | null + notes?: string | null + state_uf?: string + supplier_id?: string + tax_regime?: string | null + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "supplier_branches_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_branches_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_branches_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_branches_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + supplier_categories: { + Row: { + created_at: string | null + id: string + level: number | null + parent_code: string | null + raw_data: Json | null + supplier_code: string + supplier_id: string | null + supplier_name: string + } + Insert: { + created_at?: string | null + id?: string + level?: number | null + parent_code?: string | null + raw_data?: Json | null + supplier_code: string + supplier_id?: string | null + supplier_name: string + } + Update: { + created_at?: string | null + id?: string + level?: number | null + parent_code?: string | null + raw_data?: Json | null + supplier_code?: string + supplier_id?: string | null + supplier_name?: string + } + Relationships: [ + { + foreignKeyName: "supplier_categories_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_categories_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_categories_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_categories_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + supplier_category_mappings: { + Row: { + category_id: string | null + confidence: number | null + created_at: string | null + id: string + supplier_category_id: string | null + } + Insert: { + category_id?: string | null + confidence?: number | null + created_at?: string | null + id?: string + supplier_category_id?: string | null + } + Update: { + category_id?: string | null + confidence?: number | null + created_at?: string | null + id?: string + supplier_category_id?: string | null + } + Relationships: [ + { + foreignKeyName: "supplier_category_mappings_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_category_mappings_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "supplier_category_mappings_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "supplier_category_mappings_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "supplier_category_mappings_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "supplier_category_mappings_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "supplier_category_mappings_supplier_category_id_fkey" + columns: ["supplier_category_id"] + isOneToOne: false + referencedRelation: "supplier_categories" + referencedColumns: ["id"] + }, + ] + } + supplier_colors: { + Row: { + api_color_id: string | null + api_description: string | null + api_optional_description: string | null + api_raw_data: Json | null + code: string | null + color_variation_id: string | null + created_at: string | null + hex_code: string | null + id: string + image_url: string | null + is_active: boolean | null + is_available: boolean | null + name: string + notes: string | null + organization_id: string + source: string | null + supplier_id: string + updated_at: string | null + } + Insert: { + api_color_id?: string | null + api_description?: string | null + api_optional_description?: string | null + api_raw_data?: Json | null + code?: string | null + color_variation_id?: string | null + created_at?: string | null + hex_code?: string | null + id?: string + image_url?: string | null + is_active?: boolean | null + is_available?: boolean | null + name: string + notes?: string | null + organization_id: string + source?: string | null + supplier_id: string + updated_at?: string | null + } + Update: { + api_color_id?: string | null + api_description?: string | null + api_optional_description?: string | null + api_raw_data?: Json | null + code?: string | null + color_variation_id?: string | null + created_at?: string | null + hex_code?: string | null + id?: string + image_url?: string | null + is_active?: boolean | null + is_available?: boolean | null + name?: string + notes?: string | null + organization_id?: string + source?: string | null + supplier_id?: string + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "supplier_colors_color_variation_id_fkey" + columns: ["color_variation_id"] + isOneToOne: false + referencedRelation: "color_variations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_colors_color_variation_id_fkey" + columns: ["color_variation_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["promo_variation_id"] + }, + { + foreignKeyName: "supplier_colors_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_colors_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_colors_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_colors_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + supplier_field_mappings: { + Row: { + created_at: string | null + created_by: string | null + id: string + is_active: boolean | null + priority: number | null + source_field: string + source_path: string | null + source_unit: string | null + supplier_id: string + target_field: string + target_table: string + target_unit: string | null + transform_config: Json | null + transform_type: string + updated_at: string | null + } + Insert: { + created_at?: string | null + created_by?: string | null + id?: string + is_active?: boolean | null + priority?: number | null + source_field: string + source_path?: string | null + source_unit?: string | null + supplier_id: string + target_field: string + target_table: string + target_unit?: string | null + transform_config?: Json | null + transform_type?: string + updated_at?: string | null + } + Update: { + created_at?: string | null + created_by?: string | null + id?: string + is_active?: boolean | null + priority?: number | null + source_field?: string + source_path?: string | null + source_unit?: string | null + supplier_id?: string + target_field?: string + target_table?: string + target_unit?: string | null + transform_config?: Json | null + transform_type?: string + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "supplier_field_mappings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_field_mappings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_field_mappings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_field_mappings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + supplier_field_priority: { + Row: { + condition_config: Json | null + created_at: string | null + id: string + is_active: boolean | null + priority: number + supplier_id: string + target_field: string + target_table: string + } + Insert: { + condition_config?: Json | null + created_at?: string | null + id?: string + is_active?: boolean | null + priority: number + supplier_id: string + target_field: string + target_table: string + } + Update: { + condition_config?: Json | null + created_at?: string | null + id?: string + is_active?: boolean | null + priority?: number + supplier_id?: string + target_field?: string + target_table?: string + } + Relationships: [ + { + foreignKeyName: "supplier_field_priority_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_field_priority_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_field_priority_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_field_priority_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + supplier_image_requirements: { + Row: { + allowed_formats: string[] | null + aspect_ratio_tolerance: number | null + created_at: string | null + id: string + ideal_height_px: number | null + ideal_width_px: number | null + is_active: boolean | null + max_file_size_mb: number | null + max_height_px: number | null + max_width_px: number | null + min_height_px: number + min_quality_score: number | null + min_width_px: number + notes: string | null + preferred_format: string | null + require_square_aspect: boolean | null + require_white_background: boolean | null + supplier_code: string + supplier_name: string | null + updated_at: string | null + } + Insert: { + allowed_formats?: string[] | null + aspect_ratio_tolerance?: number | null + created_at?: string | null + id?: string + ideal_height_px?: number | null + ideal_width_px?: number | null + is_active?: boolean | null + max_file_size_mb?: number | null + max_height_px?: number | null + max_width_px?: number | null + min_height_px?: number + min_quality_score?: number | null + min_width_px?: number + notes?: string | null + preferred_format?: string | null + require_square_aspect?: boolean | null + require_white_background?: boolean | null + supplier_code: string + supplier_name?: string | null + updated_at?: string | null + } + Update: { + allowed_formats?: string[] | null + aspect_ratio_tolerance?: number | null + created_at?: string | null + id?: string + ideal_height_px?: number | null + ideal_width_px?: number | null + is_active?: boolean | null + max_file_size_mb?: number | null + max_height_px?: number | null + max_width_px?: number | null + min_height_px?: number + min_quality_score?: number | null + min_width_px?: number + notes?: string | null + preferred_format?: string | null + require_square_aspect?: boolean | null + require_white_background?: boolean | null + supplier_code?: string + supplier_name?: string | null + updated_at?: string | null + } + Relationships: [] + } + supplier_image_suffix_mappings: { + Row: { + confidence_score: number | null + created_at: string | null + display_priority_override: number | null + force_color_specific: boolean | null + force_primary_candidate: boolean | null + gallery_order_override: number | null + id: string + image_type_code: string + image_type_id: string + is_active: boolean | null + is_validated: boolean | null + mapping_notes: string | null + suffix_pattern: string + supplier_code: string + supplier_suffix_id: string + updated_at: string | null + validated_at: string | null + validated_by: string | null + } + Insert: { + confidence_score?: number | null + created_at?: string | null + display_priority_override?: number | null + force_color_specific?: boolean | null + force_primary_candidate?: boolean | null + gallery_order_override?: number | null + id?: string + image_type_code: string + image_type_id: string + is_active?: boolean | null + is_validated?: boolean | null + mapping_notes?: string | null + suffix_pattern: string + supplier_code: string + supplier_suffix_id: string + updated_at?: string | null + validated_at?: string | null + validated_by?: string | null + } + Update: { + confidence_score?: number | null + created_at?: string | null + display_priority_override?: number | null + force_color_specific?: boolean | null + force_primary_candidate?: boolean | null + gallery_order_override?: number | null + id?: string + image_type_code?: string + image_type_id?: string + is_active?: boolean | null + is_validated?: boolean | null + mapping_notes?: string | null + suffix_pattern?: string + supplier_code?: string + supplier_suffix_id?: string + updated_at?: string | null + validated_at?: string | null + validated_by?: string | null + } + Relationships: [ + { + foreignKeyName: "supplier_image_suffix_mappings_image_type_id_fkey" + columns: ["image_type_id"] + isOneToOne: false + referencedRelation: "image_types" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_image_suffix_mappings_image_type_id_fkey" + columns: ["image_type_id"] + isOneToOne: false + referencedRelation: "v_image_types_complete" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_image_suffix_mappings_supplier_suffix_id_fkey" + columns: ["supplier_suffix_id"] + isOneToOne: false + referencedRelation: "supplier_image_suffix_patterns" + referencedColumns: ["id"] + }, + ] + } + supplier_image_suffix_patterns: { + Row: { + api_fields: Json | null + created_at: string | null + example_filename: string | null + example_url: string | null + file_format: string | null + id: string + images_count: number | null + is_active: boolean | null + is_color_specific: boolean | null + last_analysis_at: string | null + suffix_pattern: string + suffix_regex: string | null + supplier_code: string + supplier_description: string | null + supplier_id: string | null + supplier_name: string | null + updated_at: string | null + } + Insert: { + api_fields?: Json | null + created_at?: string | null + example_filename?: string | null + example_url?: string | null + file_format?: string | null + id?: string + images_count?: number | null + is_active?: boolean | null + is_color_specific?: boolean | null + last_analysis_at?: string | null + suffix_pattern: string + suffix_regex?: string | null + supplier_code: string + supplier_description?: string | null + supplier_id?: string | null + supplier_name?: string | null + updated_at?: string | null + } + Update: { + api_fields?: Json | null + created_at?: string | null + example_filename?: string | null + example_url?: string | null + file_format?: string | null + id?: string + images_count?: number | null + is_active?: boolean | null + is_color_specific?: boolean | null + last_analysis_at?: string | null + suffix_pattern?: string + suffix_regex?: string | null + supplier_code?: string + supplier_description?: string | null + supplier_id?: string | null + supplier_name?: string | null + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "supplier_image_suffix_patterns_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_image_suffix_patterns_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_image_suffix_patterns_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_image_suffix_patterns_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + supplier_import_batches: { + Row: { + created_at: string | null + error_log: Json | null + finished_at: string | null + id: string + notes: string | null + products_errors: number | null + products_imported: number | null + products_updated: number | null + started_at: string | null + status: string | null + supplier_id: string + variants_errors: number | null + variants_imported: number | null + variants_updated: number | null + } + Insert: { + created_at?: string | null + error_log?: Json | null + finished_at?: string | null + id?: string + notes?: string | null + products_errors?: number | null + products_imported?: number | null + products_updated?: number | null + started_at?: string | null + status?: string | null + supplier_id: string + variants_errors?: number | null + variants_imported?: number | null + variants_updated?: number | null + } + Update: { + created_at?: string | null + error_log?: Json | null + finished_at?: string | null + id?: string + notes?: string | null + products_errors?: number | null + products_imported?: number | null + products_updated?: number | null + started_at?: string | null + status?: string | null + supplier_id?: string + variants_errors?: number | null + variants_imported?: number | null + variants_updated?: number | null + } + Relationships: [ + { + foreignKeyName: "supplier_import_batches_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_import_batches_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_import_batches_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_import_batches_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + supplier_materials: { + Row: { + api_material_group: string | null + api_material_key: string + api_material_name: string | null + created_at: string | null + id: string + raw_data: Json | null + supplier_id: string + updated_at: string | null + } + Insert: { + api_material_group?: string | null + api_material_key: string + api_material_name?: string | null + created_at?: string | null + id?: string + raw_data?: Json | null + supplier_id: string + updated_at?: string | null + } + Update: { + api_material_group?: string | null + api_material_key?: string + api_material_name?: string | null + created_at?: string | null + id?: string + raw_data?: Json | null + supplier_id?: string + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "supplier_materials_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_materials_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_materials_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_materials_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + supplier_packagings: { + Row: { + active: boolean | null + created_at: string | null + currency: string | null + id: string + is_available: boolean | null + last_price_update: string | null + lead_time_days: number | null + min_order_quantity: number | null + packaging_id: string + supplier_code: string | null + supplier_id: string + supplier_name: string | null + unit_price: number | null + updated_at: string | null + } + Insert: { + active?: boolean | null + created_at?: string | null + currency?: string | null + id?: string + is_available?: boolean | null + last_price_update?: string | null + lead_time_days?: number | null + min_order_quantity?: number | null + packaging_id: string + supplier_code?: string | null + supplier_id: string + supplier_name?: string | null + unit_price?: number | null + updated_at?: string | null + } + Update: { + active?: boolean | null + created_at?: string | null + currency?: string | null + id?: string + is_available?: boolean | null + last_price_update?: string | null + lead_time_days?: number | null + min_order_quantity?: number | null + packaging_id?: string + supplier_code?: string | null + supplier_id?: string + supplier_name?: string | null + unit_price?: number | null + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "supplier_packagings_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "packagings" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_packagings_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["packaging_id"] + }, + { + foreignKeyName: "supplier_packagings_packaging_id_fkey" + columns: ["packaging_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["packaging_id"] + }, + { + foreignKeyName: "supplier_packagings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_packagings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_packagings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_packagings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + supplier_products_raw: { + Row: { + created_at: string | null + id: string + images_processed: boolean | null + import_batch_id: string | null + imported_at: string | null + process_errors: Json | null + processed: boolean | null + processed_at: string | null + product_id: string | null + raw_data: Json + raw_hash: string | null + supplier_id: string + supplier_reference: string + supplier_sku: string | null + updated_at: string | null + variant_id: string | null + } + Insert: { + created_at?: string | null + id?: string + images_processed?: boolean | null + import_batch_id?: string | null + imported_at?: string | null + process_errors?: Json | null + processed?: boolean | null + processed_at?: string | null + product_id?: string | null + raw_data: Json + raw_hash?: string | null + supplier_id: string + supplier_reference: string + supplier_sku?: string | null + updated_at?: string | null + variant_id?: string | null + } + Update: { + created_at?: string | null + id?: string + images_processed?: boolean | null + import_batch_id?: string | null + imported_at?: string | null + process_errors?: Json | null + processed?: boolean | null + processed_at?: string | null + product_id?: string | null + raw_data?: Json + raw_hash?: string | null + supplier_id?: string + supplier_reference?: string + supplier_sku?: string | null + updated_at?: string | null + variant_id?: string | null + } + Relationships: [ + { + foreignKeyName: "supplier_products_raw_import_batch_id_fkey" + columns: ["import_batch_id"] + isOneToOne: false + referencedRelation: "supplier_import_batches" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_products_raw_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_products_raw_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_products_raw_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_products_raw_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_products_raw_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_products_raw_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "product_variants" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_products_raw_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "supplier_products_raw_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "supplier_products_raw_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_variant_sale_prices" + referencedColumns: ["variant_id"] + }, + ] + } + supplier_property_mappings: { + Row: { + active: boolean | null + created_at: string | null + id: string + notes: string | null + priority: number | null + property_code: string + raw_pattern: string + supplier_code: string + supplier_id: string | null + updated_at: string | null + } + Insert: { + active?: boolean | null + created_at?: string | null + id?: string + notes?: string | null + priority?: number | null + property_code: string + raw_pattern: string + supplier_code: string + supplier_id?: string | null + updated_at?: string | null + } + Update: { + active?: boolean | null + created_at?: string | null + id?: string + notes?: string | null + priority?: number | null + property_code?: string + raw_pattern?: string + supplier_code?: string + supplier_id?: string | null + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "supplier_property_mappings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_property_mappings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_property_mappings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_property_mappings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + supplier_settings: { + Row: { + auto_sync_enabled: boolean | null + created_at: string | null + default_is_imported: boolean | null + default_lead_time_days: number | null + default_packing_classification: string | null + default_supply_mode: string | null + id: string + supplier_id: string + updated_at: string | null + use_origin_country: boolean | null + } + Insert: { + auto_sync_enabled?: boolean | null + created_at?: string | null + default_is_imported?: boolean | null + default_lead_time_days?: number | null + default_packing_classification?: string | null + default_supply_mode?: string | null + id?: string + supplier_id: string + updated_at?: string | null + use_origin_country?: boolean | null + } + Update: { + auto_sync_enabled?: boolean | null + created_at?: string | null + default_is_imported?: boolean | null + default_lead_time_days?: number | null + default_packing_classification?: string | null + default_supply_mode?: string | null + id?: string + supplier_id?: string + updated_at?: string | null + use_origin_country?: boolean | null + } + Relationships: [ + { + foreignKeyName: "supplier_settings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: true + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_settings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: true + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_settings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: true + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_settings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: true + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + supplier_technique_mappings: { + Row: { + confidence: number | null + created_at: string | null + id: string + is_verified: boolean | null + mapped_by: string | null + supplier_name: string | null + supplier_technique_code: string | null + supplier_technique_name: string + target_technique_id: string | null + updated_at: string | null + } + Insert: { + confidence?: number | null + created_at?: string | null + id?: string + is_verified?: boolean | null + mapped_by?: string | null + supplier_name?: string | null + supplier_technique_code?: string | null + supplier_technique_name: string + target_technique_id?: string | null + updated_at?: string | null + } + Update: { + confidence?: number | null + created_at?: string | null + id?: string + is_verified?: boolean | null + mapped_by?: string | null + supplier_name?: string | null + supplier_technique_code?: string | null + supplier_technique_name?: string + target_technique_id?: string | null + updated_at?: string | null + } + Relationships: [] + } + supplier_unit_conversions: { + Row: { + created_at: string | null + description: string | null + id: string + is_active: boolean | null + is_default: boolean | null + multiplier: number + source_unit: string + supplier_id: string | null + target_unit: string + unit_type: string | null + } + Insert: { + created_at?: string | null + description?: string | null + id?: string + is_active?: boolean | null + is_default?: boolean | null + multiplier: number + source_unit: string + supplier_id?: string | null + target_unit: string + unit_type?: string | null + } + Update: { + created_at?: string | null + description?: string | null + id?: string + is_active?: boolean | null + is_default?: boolean | null + multiplier?: number + source_unit?: string + supplier_id?: string | null + target_unit?: string + unit_type?: string | null + } + Relationships: [ + { + foreignKeyName: "supplier_unit_conversions_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_unit_conversions_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_unit_conversions_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_unit_conversions_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + supplier_value_mappings: { + Row: { + created_at: string | null + display_value: string | null + field_type: string + id: string + is_active: boolean | null + sort_order: number | null + source_value: string + supplier_id: string + target_value: string + updated_at: string | null + } + Insert: { + created_at?: string | null + display_value?: string | null + field_type: string + id?: string + is_active?: boolean | null + sort_order?: number | null + source_value: string + supplier_id: string + target_value: string + updated_at?: string | null + } + Update: { + created_at?: string | null + display_value?: string | null + field_type?: string + id?: string + is_active?: boolean | null + sort_order?: number | null + source_value?: string + supplier_id?: string + target_value?: string + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "supplier_value_mappings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "supplier_value_mappings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_value_mappings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "supplier_value_mappings_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + supplier_video_requirements: { + Row: { + allowed_formats: string[] | null + created_at: string | null + id: string + ideal_height_px: number | null + ideal_width_px: number | null + is_active: boolean | null + max_duration_seconds: number | null + max_file_size_mb: number | null + min_duration_seconds: number | null + min_height_px: number + min_width_px: number + notes: string | null + supplier_code: string + supplier_name: string | null + updated_at: string | null + } + Insert: { + allowed_formats?: string[] | null + created_at?: string | null + id?: string + ideal_height_px?: number | null + ideal_width_px?: number | null + is_active?: boolean | null + max_duration_seconds?: number | null + max_file_size_mb?: number | null + min_duration_seconds?: number | null + min_height_px?: number + min_width_px?: number + notes?: string | null + supplier_code: string + supplier_name?: string | null + updated_at?: string | null + } + Update: { + allowed_formats?: string[] | null + created_at?: string | null + id?: string + ideal_height_px?: number | null + ideal_width_px?: number | null + is_active?: boolean | null + max_duration_seconds?: number | null + max_file_size_mb?: number | null + min_duration_seconds?: number | null + min_height_px?: number + min_width_px?: number + notes?: string | null + supplier_code?: string + supplier_name?: string | null + updated_at?: string | null + } + Relationships: [] + } + suppliers: { + Row: { + active: boolean | null + address: string | null + api_base_url: string | null + api_credentials: Json | null + api_rate_limit_per_hour: number | null + api_requests_current_hour: number | null + api_requests_reset_at: string | null + api_type: string | null + cnpj: string | null + code: string | null + contact_name: string | null + contact_person: string | null + created_at: string + default_markup_percent: number | null + delivery_time_days: number | null + email: string | null + id: string + inscricao_estadual: string | null + is_engraving_supplier: boolean | null + is_product_supplier: boolean | null + last_full_sync_at: string | null + last_sync_error: string | null + last_sync_status: string | null + logo_url: string | null + min_order_value: number | null + minimum_order_value: number | null + name: string + notes: string | null + organization_id: string | null + payment_terms: string | null + phone: string | null + phone2: string | null + priority: number | null + shipping_terms: string | null + state_uf: string | null + sync_enabled: boolean | null + sync_interval_minutes: number | null + tax_regime: string | null + trading_name: string | null + updated_at: string | null + website: string | null + } + Insert: { + active?: boolean | null + address?: string | null + api_base_url?: string | null + api_credentials?: Json | null + api_rate_limit_per_hour?: number | null + api_requests_current_hour?: number | null + api_requests_reset_at?: string | null + api_type?: string | null + cnpj?: string | null + code?: string | null + contact_name?: string | null + contact_person?: string | null + created_at?: string + default_markup_percent?: number | null + delivery_time_days?: number | null + email?: string | null + id?: string + inscricao_estadual?: string | null + is_engraving_supplier?: boolean | null + is_product_supplier?: boolean | null + last_full_sync_at?: string | null + last_sync_error?: string | null + last_sync_status?: string | null + logo_url?: string | null + min_order_value?: number | null + minimum_order_value?: number | null + name: string + notes?: string | null + organization_id?: string | null + payment_terms?: string | null + phone?: string | null + phone2?: string | null + priority?: number | null + shipping_terms?: string | null + state_uf?: string | null + sync_enabled?: boolean | null + sync_interval_minutes?: number | null + tax_regime?: string | null + trading_name?: string | null + updated_at?: string | null + website?: string | null + } + Update: { + active?: boolean | null + address?: string | null + api_base_url?: string | null + api_credentials?: Json | null + api_rate_limit_per_hour?: number | null + api_requests_current_hour?: number | null + api_requests_reset_at?: string | null + api_type?: string | null + cnpj?: string | null + code?: string | null + contact_name?: string | null + contact_person?: string | null + created_at?: string + default_markup_percent?: number | null + delivery_time_days?: number | null + email?: string | null + id?: string + inscricao_estadual?: string | null + is_engraving_supplier?: boolean | null + is_product_supplier?: boolean | null + last_full_sync_at?: string | null + last_sync_error?: string | null + last_sync_status?: string | null + logo_url?: string | null + min_order_value?: number | null + minimum_order_value?: number | null + name?: string + notes?: string | null + organization_id?: string | null + payment_terms?: string | null + phone?: string | null + phone2?: string | null + priority?: number | null + shipping_terms?: string | null + state_uf?: string | null + sync_enabled?: boolean | null + sync_interval_minutes?: number | null + tax_regime?: string | null + trading_name?: string | null + updated_at?: string | null + website?: string | null + } + Relationships: [ + { + foreignKeyName: "suppliers_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + ] + } + system_changelog: { + Row: { + category: string + description: string | null + executed_at: string + executed_by: string | null + id: string + impact: string | null + metadata: Json | null + step_number: number + title: string + } + Insert: { + category: string + description?: string | null + executed_at?: string + executed_by?: string | null + id?: string + impact?: string | null + metadata?: Json | null + step_number: number + title: string + } + Update: { + category?: string + description?: string | null + executed_at?: string + executed_by?: string | null + id?: string + impact?: string | null + metadata?: Json | null + step_number?: number + title?: string + } + Relationships: [] + } + system_documentation: { + Row: { + atualizado_em: string | null + criado_em: string | null + id: string + modulo: string + observacoes: string | null + proposito: string + relaciona_com: string[] | null + tabela: string | null + } + Insert: { + atualizado_em?: string | null + criado_em?: string | null + id?: string + modulo: string + observacoes?: string | null + proposito: string + relaciona_com?: string[] | null + tabela?: string | null + } + Update: { + atualizado_em?: string | null + criado_em?: string | null + id?: string + modulo?: string + observacoes?: string | null + proposito?: string + relaciona_com?: string[] | null + tabela?: string | null + } + Relationships: [] + } + system_kill_switches: { + Row: { + enabled: boolean + legacy_message: string | null + reason: string | null + switch_name: string + updated_at: string + updated_by: string | null + } + Insert: { + enabled?: boolean + legacy_message?: string | null + reason?: string | null + switch_name: string + updated_at?: string + updated_by?: string | null + } + Update: { + enabled?: boolean + legacy_message?: string | null + reason?: string | null + switch_name?: string + updated_at?: string + updated_by?: string | null + } + Relationships: [] + } + system_settings: { + Row: { + description: string | null + key: string + updated_at: string + updated_by: string | null + value: Json + } + Insert: { + description?: string | null + key: string + updated_at?: string + updated_by?: string | null + value: Json + } + Update: { + description?: string | null + key?: string + updated_at?: string + updated_by?: string | null + value?: Json + } + Relationships: [] + } + system_settings_legacy: { + Row: { + category: string | null + created_at: string | null + description: string | null + id: string + is_public: boolean | null + is_secret: boolean | null + setting_key: string + setting_value: Json + updated_at: string | null + } + Insert: { + category?: string | null + created_at?: string | null + description?: string | null + id?: string + is_public?: boolean | null + is_secret?: boolean | null + setting_key: string + setting_value: Json + updated_at?: string | null + } + Update: { + category?: string | null + created_at?: string | null + description?: string | null + id?: string + is_public?: boolean | null + is_secret?: boolean | null + setting_key?: string + setting_value?: Json + updated_at?: string | null + } + Relationships: [] + } + tabela_preco_gravacao_oficial: { + Row: { + ativo: boolean | null + cobra_por_cor: boolean | null + codigo_curto: string | null + codigo_tabela: string + created_at: string | null + custo_aplicacao: number | null + custo_manuseio: number | null + custo_queima_forno: number | null + custo_setup: number | null + custo_setup_por_cor: boolean | null + custo_termo_transferencia: number | null + desconto_segunda_cor: number | null + desconto_terceira_cor: number | null + descricao: string | null + grupo_tecnica: string | null + id: string + markup_percent: number | null + max_cores: number | null + nome: string | null + opcoes_modificadores: Json | null + preco_maximo_unitario: number | null + preco_minimo_unitario: number | null + tom_options: Json | null + updated_at: string | null + usa_faixa_dimensional: boolean | null + } + Insert: { + ativo?: boolean | null + cobra_por_cor?: boolean | null + codigo_curto?: string | null + codigo_tabela: string + created_at?: string | null + custo_aplicacao?: number | null + custo_manuseio?: number | null + custo_queima_forno?: number | null + custo_setup?: number | null + custo_setup_por_cor?: boolean | null + custo_termo_transferencia?: number | null + desconto_segunda_cor?: number | null + desconto_terceira_cor?: number | null + descricao?: string | null + grupo_tecnica?: string | null + id?: string + markup_percent?: number | null + max_cores?: number | null + nome?: string | null + opcoes_modificadores?: Json | null + preco_maximo_unitario?: number | null + preco_minimo_unitario?: number | null + tom_options?: Json | null + updated_at?: string | null + usa_faixa_dimensional?: boolean | null + } + Update: { + ativo?: boolean | null + cobra_por_cor?: boolean | null + codigo_curto?: string | null + codigo_tabela?: string + created_at?: string | null + custo_aplicacao?: number | null + custo_manuseio?: number | null + custo_queima_forno?: number | null + custo_setup?: number | null + custo_setup_por_cor?: boolean | null + custo_termo_transferencia?: number | null + desconto_segunda_cor?: number | null + desconto_terceira_cor?: number | null + descricao?: string | null + grupo_tecnica?: string | null + id?: string + markup_percent?: number | null + max_cores?: number | null + nome?: string | null + opcoes_modificadores?: Json | null + preco_maximo_unitario?: number | null + preco_minimo_unitario?: number | null + tom_options?: Json | null + updated_at?: string | null + usa_faixa_dimensional?: boolean | null + } + Relationships: [ + { + foreignKeyName: "fk_oficial_grupo_tecnica" + columns: ["grupo_tecnica"] + isOneToOne: false + referencedRelation: "tecnicas_gravacao" + referencedColumns: ["codigo"] + }, + { + foreignKeyName: "fk_oficial_grupo_tecnica" + columns: ["grupo_tecnica"] + isOneToOne: false + referencedRelation: "v_audit_cobertura_tecnicas" + referencedColumns: ["grupo"] + }, + ] + } + tabela_preco_gravacao_oficial_faixa: { + Row: { + altura_max: number | null + altura_min: number | null + created_at: string | null + id: string + largura_max: number | null + largura_min: number | null + ordem: number | null + prazo_dias: number | null + preco_unitario: number + quantidade_maxima: number | null + quantidade_minima: number + tabela_preco_gravacao_id: string + updated_at: string | null + } + Insert: { + altura_max?: number | null + altura_min?: number | null + created_at?: string | null + id?: string + largura_max?: number | null + largura_min?: number | null + ordem?: number | null + prazo_dias?: number | null + preco_unitario: number + quantidade_maxima?: number | null + quantidade_minima: number + tabela_preco_gravacao_id: string + updated_at?: string | null + } + Update: { + altura_max?: number | null + altura_min?: number | null + created_at?: string | null + id?: string + largura_max?: number | null + largura_min?: number | null + ordem?: number | null + prazo_dias?: number | null + preco_unitario?: number + quantidade_maxima?: number | null + quantidade_minima?: number + tabela_preco_gravacao_id?: string + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "tabela_preco_gravacao_faixa_tabela_preco_gravacao_id_fkey" + columns: ["tabela_preco_gravacao_id"] + isOneToOne: false + referencedRelation: "tabela_preco_gravacao_oficial" + referencedColumns: ["id"] + }, + ] + } + tags: { + Row: { + color_hex: string | null + created_at: string | null + description: string | null + id: string + is_active: boolean | null + name: string + organization_id: string + slug: string + updated_at: string | null + usage_count: number | null + } + Insert: { + color_hex?: string | null + created_at?: string | null + description?: string | null + id?: string + is_active?: boolean | null + name: string + organization_id: string + slug: string + updated_at?: string | null + usage_count?: number | null + } + Update: { + color_hex?: string | null + created_at?: string | null + description?: string | null + id?: string + is_active?: boolean | null + name?: string + organization_id?: string + slug?: string + updated_at?: string | null + usage_count?: number | null + } + Relationships: [ + { + foreignKeyName: "tags_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + ] + } + target_audiences: { + Row: { + category: string | null + color_hex: string | null + created_at: string | null + description: string | null + display_order: number | null + icon_name: string | null + id: string + is_active: boolean + name: string + organization_id: string | null + slug: string + updated_at: string | null + } + Insert: { + category?: string | null + color_hex?: string | null + created_at?: string | null + description?: string | null + display_order?: number | null + icon_name?: string | null + id?: string + is_active?: boolean + name: string + organization_id?: string | null + slug: string + updated_at?: string | null + } + Update: { + category?: string | null + color_hex?: string | null + created_at?: string | null + description?: string | null + display_order?: number | null + icon_name?: string | null + id?: string + is_active?: boolean + name?: string + organization_id?: string | null + slug?: string + updated_at?: string | null + } + Relationships: [ + { + foreignKeyName: "target_audiences_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + ] + } + tecnicas_gravacao: { + Row: { + ativo: boolean | null + codigo: string + created_at: string | null + nome: string + ordem_exibicao: number | null + slug: string + updated_at: string | null + } + Insert: { + ativo?: boolean | null + codigo: string + created_at?: string | null + nome: string + ordem_exibicao?: number | null + slug: string + updated_at?: string | null + } + Update: { + ativo?: boolean | null + codigo?: string + created_at?: string | null + nome?: string + ordem_exibicao?: number | null + slug?: string + updated_at?: string | null + } + Relationships: [] + } + user_2fa_settings: { + Row: { + backup_codes: string[] | null + created_at: string + enabled_at: string | null + id: string + is_enabled: boolean + totp_secret: string | null + user_id: string + } + Insert: { + backup_codes?: string[] | null + created_at?: string + enabled_at?: string | null + id?: string + is_enabled?: boolean + totp_secret?: string | null + user_id: string + } + Update: { + backup_codes?: string[] | null + created_at?: string + enabled_at?: string | null + id?: string + is_enabled?: boolean + totp_secret?: string | null + user_id?: string + } + Relationships: [] + } + user_allowed_ips: { + Row: { + created_at: string + created_by: string | null + id: string + ip_address: string + is_active: boolean + label: string | null + user_id: string + } + Insert: { + created_at?: string + created_by?: string | null + id?: string + ip_address: string + is_active?: boolean + label?: string | null + user_id: string + } + Update: { + created_at?: string + created_by?: string | null + id?: string + ip_address?: string + is_active?: boolean + label?: string | null + user_id?: string + } + Relationships: [] + } + user_comparisons: { + Row: { + client_id: string | null + client_name: string | null + created_at: string + id: string + is_public: boolean + items: Json + name: string | null + share_expires_at: string | null + share_token: string | null + updated_at: string + user_id: string + view_count: number + } + Insert: { + client_id?: string | null + client_name?: string | null + created_at?: string + id?: string + is_public?: boolean + items?: Json + name?: string | null + share_expires_at?: string | null + share_token?: string | null + updated_at?: string + user_id: string + view_count?: number + } + Update: { + client_id?: string | null + client_name?: string | null + created_at?: string + id?: string + is_public?: boolean + items?: Json + name?: string | null + share_expires_at?: string | null + share_token?: string | null + updated_at?: string + user_id?: string + view_count?: number + } + Relationships: [] + } + user_favorites: { + Row: { + created_at: string | null + id: string + notes: string | null + product_id: string + user_id: string + } + Insert: { + created_at?: string | null + id?: string + notes?: string | null + product_id: string + user_id: string + } + Update: { + created_at?: string | null + id?: string + notes?: string | null + product_id?: string + user_id?: string + } + Relationships: [ + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "user_favorites_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + user_filter_presets: { + Row: { + created_at: string | null + filters: Json + id: string + is_global: boolean | null + preset_name: string + updated_at: string | null + usage_count: number | null + user_id: string + } + Insert: { + created_at?: string | null + filters: Json + id?: string + is_global?: boolean | null + preset_name: string + updated_at?: string | null + usage_count?: number | null + user_id: string + } + Update: { + created_at?: string | null + filters?: Json + id?: string + is_global?: boolean | null + preset_name?: string + updated_at?: string | null + usage_count?: number | null + user_id?: string + } + Relationships: [] + } + user_known_devices: { + Row: { + created_at: string + device_name: string | null + fingerprint: string + id: string + last_seen_at: string + user_id: string + } + Insert: { + created_at?: string + device_name?: string | null + fingerprint: string + id?: string + last_seen_at?: string + user_id: string + } + Update: { + created_at?: string + device_name?: string | null + fingerprint?: string + id?: string + last_seen_at?: string + user_id?: string + } + Relationships: [] + } + user_onboarding: { + Row: { + completed_at: string | null + completed_steps: Json | null + created_at: string | null + current_step: number | null + has_completed_tour: boolean | null + id: string + started_at: string | null + updated_at: string | null + user_id: string + } + Insert: { + completed_at?: string | null + completed_steps?: Json | null + created_at?: string | null + current_step?: number | null + has_completed_tour?: boolean | null + id?: string + started_at?: string | null + updated_at?: string | null + user_id: string + } + Update: { + completed_at?: string | null + completed_steps?: Json | null + created_at?: string | null + current_step?: number | null + has_completed_tour?: boolean | null + id?: string + started_at?: string | null + updated_at?: string | null + user_id?: string + } + Relationships: [] + } + user_organizations: { + Row: { + created_at: string + organization_id: string + role: Database["public"]["Enums"]["org_role"] + updated_at: string + user_id: string + } + Insert: { + created_at?: string + organization_id: string + role?: Database["public"]["Enums"]["org_role"] + updated_at?: string + user_id: string + } + Update: { + created_at?: string + organization_id?: string + role?: Database["public"]["Enums"]["org_role"] + updated_at?: string + user_id?: string + } + Relationships: [ + { + foreignKeyName: "user_organizations_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + ] + } + user_preferences: { + Row: { + comparison_column_order: Json + comparison_weights: Json + created_at: string + filter_states: Json + id: string + updated_at: string + user_id: string + } + Insert: { + comparison_column_order?: Json + comparison_weights?: Json + created_at?: string + filter_states?: Json + id?: string + updated_at?: string + user_id: string + } + Update: { + comparison_column_order?: Json + comparison_weights?: Json + created_at?: string + filter_states?: Json + id?: string + updated_at?: string + user_id?: string + } + Relationships: [] + } + user_roles: { + Row: { + created_at: string + granted_by: string | null + role: Database["public"]["Enums"]["app_role"] + user_id: string + } + Insert: { + created_at?: string + granted_by?: string | null + role: Database["public"]["Enums"]["app_role"] + user_id: string + } + Update: { + created_at?: string + granted_by?: string | null + role?: Database["public"]["Enums"]["app_role"] + user_id?: string + } + Relationships: [] + } + user_search_history: { + Row: { + created_at: string | null + history_type: string + id: string + is_pinned: boolean | null + metadata: Json | null + query_text: string + result_count: number | null + updated_at: string | null + user_id: string + } + Insert: { + created_at?: string | null + history_type?: string + id?: string + is_pinned?: boolean | null + metadata?: Json | null + query_text: string + result_count?: number | null + updated_at?: string | null + user_id: string + } + Update: { + created_at?: string | null + history_type?: string + id?: string + is_pinned?: boolean | null + metadata?: Json | null + query_text?: string + result_count?: number | null + updated_at?: string | null + user_id?: string + } + Relationships: [] + } + user_token_revocations: { + Row: { + revoked_at: string + user_id: string + } + Insert: { + revoked_at?: string + user_id: string + } + Update: { + revoked_at?: string + user_id?: string + } + Relationships: [] + } + variant_commemorative_dates: { + Row: { + commemorative_date_id: string + created_at: string | null + created_by: string | null + custom_description: string | null + display_order: number | null + id: string + is_featured: boolean | null + product_id: string | null + variant_id: string | null + } + Insert: { + commemorative_date_id: string + created_at?: string | null + created_by?: string | null + custom_description?: string | null + display_order?: number | null + id?: string + is_featured?: boolean | null + product_id?: string | null + variant_id?: string | null + } + Update: { + commemorative_date_id?: string + created_at?: string | null + created_by?: string | null + custom_description?: string | null + display_order?: number | null + id?: string + is_featured?: boolean | null + product_id?: string | null + variant_id?: string | null + } + Relationships: [ + { + foreignKeyName: "variant_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "commemorative_dates" + referencedColumns: ["id"] + }, + { + foreignKeyName: "variant_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "v_commemorative_dates_calendar" + referencedColumns: ["id"] + }, + { + foreignKeyName: "variant_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "v_commemorative_dates_with_colors" + referencedColumns: ["id"] + }, + { + foreignKeyName: "variant_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["commemorative_date_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["date_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["date_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_commemorative_date_id_fkey" + columns: ["commemorative_date_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["date_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "variant_commemorative_dates_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "variant_commemorative_dates_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "product_variants" + referencedColumns: ["id"] + }, + { + foreignKeyName: "variant_commemorative_dates_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "variant_commemorative_dates_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_variant_sale_prices" + referencedColumns: ["variant_id"] + }, + ] + } + variant_supplier_sources: { + Row: { + cest: string | null + cfop: string | null + cofins_rate: number | null + cost_price: number | null + cost_price_1: number | null + cost_price_2: number | null + cost_price_3: number | null + cost_price_4: number | null + cost_price_5: number | null + csosn: string | null + cst: string | null + icms_rate: number | null + id: string + is_active: boolean | null + is_preferred: boolean | null + last_synced_at: string | null + lead_time_days: number | null + list_price: number | null + min_order_qty: number | null + min_qty_1: number | null + min_qty_2: number | null + min_qty_3: number | null + min_qty_4: number | null + min_qty_5: number | null + next_date_1: string | null + next_date_2: string | null + next_date_3: string | null + next_quantity_1: number | null + next_quantity_2: number | null + next_quantity_3: number | null + operation_nature: string | null + organization_id: string + pack_quantity: number | null + pis_rate: number | null + price_updated_at: string | null + priority: number | null + quantity: number | null + raw_data: Json | null + removed_at: string | null + removed_from_api: boolean | null + sale_multiplier: number | null + source: string | null + stock_main_warehouse: number + stock_other_warehouses: number + supplier_availability_status: string | null + supplier_branch_id: string | null + supplier_color_code: string | null + supplier_color_name: string | null + supplier_id: string + supplier_images: Json | null + supplier_ipi_rate: number | null + supplier_sku: string | null + supplier_thumbnail: string | null + supplier_videos: Json | null + sync_error: string | null + sync_status: string | null + updated_at: string | null + variant_id: string + } + Insert: { + cest?: string | null + cfop?: string | null + cofins_rate?: number | null + cost_price?: number | null + cost_price_1?: number | null + cost_price_2?: number | null + cost_price_3?: number | null + cost_price_4?: number | null + cost_price_5?: number | null + csosn?: string | null + cst?: string | null + icms_rate?: number | null + id?: string + is_active?: boolean | null + is_preferred?: boolean | null + last_synced_at?: string | null + lead_time_days?: number | null + list_price?: number | null + min_order_qty?: number | null + min_qty_1?: number | null + min_qty_2?: number | null + min_qty_3?: number | null + min_qty_4?: number | null + min_qty_5?: number | null + next_date_1?: string | null + next_date_2?: string | null + next_date_3?: string | null + next_quantity_1?: number | null + next_quantity_2?: number | null + next_quantity_3?: number | null + operation_nature?: string | null + organization_id: string + pack_quantity?: number | null + pis_rate?: number | null + price_updated_at?: string | null + priority?: number | null + quantity?: number | null + raw_data?: Json | null + removed_at?: string | null + removed_from_api?: boolean | null + sale_multiplier?: number | null + source?: string | null + stock_main_warehouse?: number + stock_other_warehouses?: number + supplier_availability_status?: string | null + supplier_branch_id?: string | null + supplier_color_code?: string | null + supplier_color_name?: string | null + supplier_id: string + supplier_images?: Json | null + supplier_ipi_rate?: number | null + supplier_sku?: string | null + supplier_thumbnail?: string | null + supplier_videos?: Json | null + sync_error?: string | null + sync_status?: string | null + updated_at?: string | null + variant_id: string + } + Update: { + cest?: string | null + cfop?: string | null + cofins_rate?: number | null + cost_price?: number | null + cost_price_1?: number | null + cost_price_2?: number | null + cost_price_3?: number | null + cost_price_4?: number | null + cost_price_5?: number | null + csosn?: string | null + cst?: string | null + icms_rate?: number | null + id?: string + is_active?: boolean | null + is_preferred?: boolean | null + last_synced_at?: string | null + lead_time_days?: number | null + list_price?: number | null + min_order_qty?: number | null + min_qty_1?: number | null + min_qty_2?: number | null + min_qty_3?: number | null + min_qty_4?: number | null + min_qty_5?: number | null + next_date_1?: string | null + next_date_2?: string | null + next_date_3?: string | null + next_quantity_1?: number | null + next_quantity_2?: number | null + next_quantity_3?: number | null + operation_nature?: string | null + organization_id?: string + pack_quantity?: number | null + pis_rate?: number | null + price_updated_at?: string | null + priority?: number | null + quantity?: number | null + raw_data?: Json | null + removed_at?: string | null + removed_from_api?: boolean | null + sale_multiplier?: number | null + source?: string | null + stock_main_warehouse?: number + stock_other_warehouses?: number + supplier_availability_status?: string | null + supplier_branch_id?: string | null + supplier_color_code?: string | null + supplier_color_name?: string | null + supplier_id?: string + supplier_images?: Json | null + supplier_ipi_rate?: number | null + supplier_sku?: string | null + supplier_thumbnail?: string | null + supplier_videos?: Json | null + sync_error?: string | null + sync_status?: string | null + updated_at?: string | null + variant_id?: string + } + Relationships: [ + { + foreignKeyName: "variant_stocks_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "variant_stocks_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "variant_stocks_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "variant_stocks_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "variant_stocks_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "product_variants" + referencedColumns: ["id"] + }, + { + foreignKeyName: "variant_stocks_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "variant_stocks_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "variant_stocks_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_variant_sale_prices" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "variant_supplier_sources_supplier_branch_id_fkey" + columns: ["supplier_branch_id"] + isOneToOne: false + referencedRelation: "supplier_branches" + referencedColumns: ["id"] + }, + ] + } + variation_types: { + Row: { + code: string + created_at: string | null + description: string | null + id: string + is_active: boolean | null + is_required: boolean | null + name: string + organization_id: string + slug: string + sort_order: number | null + updated_at: string | null + value_type: string | null + } + Insert: { + code: string + created_at?: string | null + description?: string | null + id?: string + is_active?: boolean | null + is_required?: boolean | null + name: string + organization_id: string + slug: string + sort_order?: number | null + updated_at?: string | null + value_type?: string | null + } + Update: { + code?: string + created_at?: string | null + description?: string | null + id?: string + is_active?: boolean | null + is_required?: boolean | null + name?: string + organization_id?: string + slug?: string + sort_order?: number | null + updated_at?: string | null + value_type?: string | null + } + Relationships: [] + } + variation_values: { + Row: { + created_at: string | null + description: string | null + id: string + is_active: boolean | null + label: string | null + organization_id: string + sort_order: number | null + updated_at: string | null + value: string + variation_type_id: string + } + Insert: { + created_at?: string | null + description?: string | null + id?: string + is_active?: boolean | null + label?: string | null + organization_id: string + sort_order?: number | null + updated_at?: string | null + value: string + variation_type_id: string + } + Update: { + created_at?: string | null + description?: string | null + id?: string + is_active?: boolean | null + label?: string | null + organization_id?: string + sort_order?: number | null + updated_at?: string | null + value?: string + variation_type_id?: string + } + Relationships: [ + { + foreignKeyName: "variation_values_variation_type_id_fkey" + columns: ["variation_type_id"] + isOneToOne: false + referencedRelation: "variation_types" + referencedColumns: ["id"] + }, + ] + } + video_import_queue: { + Row: { + cloudflare_duration_seconds: number | null + cloudflare_embed: string | null + cloudflare_hls: string | null + cloudflare_thumbnail: string | null + cloudflare_video_id: string | null + completed_at: string | null + created_at: string | null + file_size_bytes: number | null + id: string + last_error: string | null + local_file_path: string | null + max_retries: number | null + product_references: string[] + retry_count: number | null + source_supplier: string + started_at: string | null + status: string + updated_at: string | null + youtube_id: string + youtube_url: string + } + Insert: { + cloudflare_duration_seconds?: number | null + cloudflare_embed?: string | null + cloudflare_hls?: string | null + cloudflare_thumbnail?: string | null + cloudflare_video_id?: string | null + completed_at?: string | null + created_at?: string | null + file_size_bytes?: number | null + id?: string + last_error?: string | null + local_file_path?: string | null + max_retries?: number | null + product_references?: string[] + retry_count?: number | null + source_supplier?: string + started_at?: string | null + status?: string + updated_at?: string | null + youtube_id: string + youtube_url: string + } + Update: { + cloudflare_duration_seconds?: number | null + cloudflare_embed?: string | null + cloudflare_hls?: string | null + cloudflare_thumbnail?: string | null + cloudflare_video_id?: string | null + completed_at?: string | null + created_at?: string | null + file_size_bytes?: number | null + id?: string + last_error?: string | null + local_file_path?: string | null + max_retries?: number | null + product_references?: string[] + retry_count?: number | null + source_supplier?: string + started_at?: string | null + status?: string + updated_at?: string | null + youtube_id?: string + youtube_url?: string + } + Relationships: [] + } + video_types: { + Row: { + autoplay: boolean | null + category: string + code: string + controls: boolean | null + created_at: string | null + description: string | null + display_priority: number | null + icon: string | null + id: string + is_active: boolean | null + loop: boolean | null + muted: boolean | null + name: string + name_en: string | null + updated_at: string | null + } + Insert: { + autoplay?: boolean | null + category?: string + code: string + controls?: boolean | null + created_at?: string | null + description?: string | null + display_priority?: number | null + icon?: string | null + id?: string + is_active?: boolean | null + loop?: boolean | null + muted?: boolean | null + name: string + name_en?: string | null + updated_at?: string | null + } + Update: { + autoplay?: boolean | null + category?: string + code?: string + controls?: boolean | null + created_at?: string | null + description?: string | null + display_priority?: number | null + icon?: string | null + id?: string + is_active?: boolean | null + loop?: boolean | null + muted?: boolean | null + name?: string + name_en?: string | null + updated_at?: string | null + } + Relationships: [] + } + video_validation_log: { + Row: { + action_type: string | null + cloudflare_video_id: string | null + duration_seconds: number | null + file_size_bytes: number | null + height_px: number | null + id: string + is_valid: boolean + issues: string[] | null + product_id: string | null + recommendations: string[] | null + supplier_code: string | null + validated_at: string | null + validation_status: string + video_id: string + width_px: number | null + } + Insert: { + action_type?: string | null + cloudflare_video_id?: string | null + duration_seconds?: number | null + file_size_bytes?: number | null + height_px?: number | null + id?: string + is_valid?: boolean + issues?: string[] | null + product_id?: string | null + recommendations?: string[] | null + supplier_code?: string | null + validated_at?: string | null + validation_status: string + video_id: string + width_px?: number | null + } + Update: { + action_type?: string | null + cloudflare_video_id?: string | null + duration_seconds?: number | null + file_size_bytes?: number | null + height_px?: number | null + id?: string + is_valid?: boolean + issues?: string[] | null + product_id?: string | null + recommendations?: string[] | null + supplier_code?: string | null + validated_at?: string | null + validation_status?: string + video_id?: string + width_px?: number | null + } + Relationships: [] + } + video_variant_links: { + Row: { + created_at: string + id: string + product_id: string + supplier_code: string | null + variant_color_hex: string | null + variant_id: string + variant_name: string | null + video_id: string + } + Insert: { + created_at?: string + id?: string + product_id: string + supplier_code?: string | null + variant_color_hex?: string | null + variant_id: string + variant_name?: string | null + video_id: string + } + Update: { + created_at?: string + id?: string + product_id?: string + supplier_code?: string | null + variant_color_hex?: string | null + variant_id?: string + variant_name?: string | null + video_id?: string + } + Relationships: [] + } + voice_command_logs: { + Row: { + action: string + created_at: string + data: Json | null + duration_ms: number | null + id: string + response: string | null + success: boolean | null + transcript: string + user_id: string + } + Insert: { + action: string + created_at?: string + data?: Json | null + duration_ms?: number | null + id?: string + response?: string | null + success?: boolean | null + transcript: string + user_id: string + } + Update: { + action?: string + created_at?: string + data?: Json | null + duration_ms?: number | null + id?: string + response?: string | null + success?: boolean | null + transcript?: string + user_id?: string + } + Relationships: [] + } + webhook_deliveries: { + Row: { + attempt: number + delivered_at: string + error_message: string | null + event: string + id: string + payload: Json | null + payload_hash: string | null + response_body_truncated: string | null + status_code: number | null + success: boolean + webhook_id: string + } + Insert: { + attempt?: number + delivered_at?: string + error_message?: string | null + event: string + id?: string + payload?: Json | null + payload_hash?: string | null + response_body_truncated?: string | null + status_code?: number | null + success?: boolean + webhook_id: string + } + Update: { + attempt?: number + delivered_at?: string + error_message?: string | null + event?: string + id?: string + payload?: Json | null + payload_hash?: string | null + response_body_truncated?: string | null + status_code?: number | null + success?: boolean + webhook_id?: string + } + Relationships: [ + { + foreignKeyName: "webhook_deliveries_webhook_id_fkey" + columns: ["webhook_id"] + isOneToOne: false + referencedRelation: "outbound_webhooks" + referencedColumns: ["id"] + }, + ] + } + webhook_delivery_metrics: { + Row: { + attempt: number | null + direction: string | null + duration_ms: number | null + endpoint: string | null + error_class: string | null + error_message: string | null + event_type: string | null + http_status: number | null + id: string + metadata: Json | null + occurred_at: string + payload_bytes: number | null + request_id: string | null + source: string | null + success: boolean | null + } + Insert: { + attempt?: number | null + direction?: string | null + duration_ms?: number | null + endpoint?: string | null + error_class?: string | null + error_message?: string | null + event_type?: string | null + http_status?: number | null + id?: string + metadata?: Json | null + occurred_at?: string + payload_bytes?: number | null + request_id?: string | null + source?: string | null + success?: boolean | null + } + Update: { + attempt?: number | null + direction?: string | null + duration_ms?: number | null + endpoint?: string | null + error_class?: string | null + error_message?: string | null + event_type?: string | null + http_status?: number | null + id?: string + metadata?: Json | null + occurred_at?: string + payload_bytes?: number | null + request_id?: string | null + source?: string | null + success?: boolean | null + } + Relationships: [] + } + webhook_request_nonces: { + Row: { + created_at: string + expires_at: string + id: string + nonce: string + request_timestamp: string + source: string + } + Insert: { + created_at?: string + expires_at: string + id?: string + nonce: string + request_timestamp: string + source: string + } + Update: { + created_at?: string + expires_at?: string + id?: string + nonce?: string + request_timestamp?: string + source?: string + } + Relationships: [] + } + workspace_notifications: { + Row: { + action_url: string | null + category: string + created_at: string + id: string + is_read: boolean + message: string + metadata: Json | null + title: string + type: string + user_id: string + } + Insert: { + action_url?: string | null + category?: string + created_at?: string + id?: string + is_read?: boolean + message: string + metadata?: Json | null + title: string + type?: string + user_id: string + } + Update: { + action_url?: string | null + category?: string + created_at?: string + id?: string + is_read?: boolean + message?: string + metadata?: Json | null + title?: string + type?: string + user_id?: string + } + Relationships: [] + } + xbz_gallery_staging: { + Row: { + cloudflare_image_id: string | null + codigo_amigavel: string + created_at: string | null + d_number: number + error_message: string | null + file_size_bytes: number | null + http_status: number | null + id: string + product_id: string | null + status: string + updated_at: string | null + url_cdn: string | null + url_original: string + } + Insert: { + cloudflare_image_id?: string | null + codigo_amigavel: string + created_at?: string | null + d_number: number + error_message?: string | null + file_size_bytes?: number | null + http_status?: number | null + id?: string + product_id?: string | null + status?: string + updated_at?: string | null + url_cdn?: string | null + url_original: string + } + Update: { + cloudflare_image_id?: string | null + codigo_amigavel?: string + created_at?: string | null + d_number?: number + error_message?: string | null + file_size_bytes?: number | null + http_status?: number | null + id?: string + product_id?: string | null + status?: string + updated_at?: string | null + url_cdn?: string | null + url_original?: string + } + Relationships: [] + } + } + Views: { + bi_quotes_summary: { + Row: { + avg_ticket: number | null + month: string | null + quote_count: number | null + seller_id: string | null + status: string | null + total_revenue: number | null + } + Relationships: [] + } + categories_tree_visual: { + Row: { + bitrix_id: number | null + id: string | null + level: number | null + name: string | null + parent_id: string | null + sort_path: number[] | null + tree_structure: string | null + } + Relationships: [] + } + materials_complete: { + Row: { + created_at: string | null + description: string | null + group_id: string | null + group_name: string | null + group_slug: string | null + is_active: boolean | null + material_id: string | null + material_name: string | null + material_slug: string | null + organization_id: string | null + products_count: number | null + updated_at: string | null + } + Relationships: [ + { + foreignKeyName: "material_types_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + ] + } + mv_material_group_stats: { + Row: { + active_materials: number | null + group_id: string | null + group_name: string | null + group_slug: string | null + organization_id: string | null + products_using: number | null + total_materials: number | null + } + Relationships: [] + } + mv_media_health: { + Row: { + com_img_principal: number | null + com_qualquer_img: number | null + imagens_com_seo: number | null + imagens_vinculadas: number | null + pct_cobertura_principal: number | null + pct_cobertura_qualquer: number | null + source_supplier: string | null + total_imagens: number | null + total_produtos: number | null + } + Relationships: [] + } + mv_product_cards: { + Row: { + category_id: string | null + colors: Json | null + id: string | null + is_active: boolean | null + is_featured: boolean | null + is_new: boolean | null + is_stockout: boolean | null + main_category_id: string | null + name: string | null + primary_image_cdn: string | null + primary_image_url: string | null + product_type: string | null + sale_price: number | null + short_description: string | null + sku: string | null + slug: string | null + supplier_id: string | null + total_stock: number | null + variant_count: number | null + } + Relationships: [] + } + mv_product_compositions: { + Row: { + materials_detail: Json[] | null + organization_id: string | null + product_id: string | null + product_name: string | null + total_materials: number | null + total_percentage: number | null + } + Relationships: [] + } + mv_product_intelligence: { + Row: { + abc_classification: string | null + avg_current_price: number | null + avg_depletion_30d: number | null + avg_depletion_7d: number | null + has_frequent_restock: boolean | null + is_hot_product: boolean | null + is_negotiation_opportunity: boolean | null + is_stagnant: boolean | null + is_stockout_risk: boolean | null + max_velocity_trend: number | null + min_days_to_stockout: number | null + product_id: string | null + refreshed_at: string | null + supplier_count: number | null + total_current_stock: number | null + total_depleted_30d: number | null + total_depleted_90d: number | null + total_restocked_30d: number | null + turnover_score: number | null + } + Relationships: [] + } + mv_stock_velocity: { + Row: { + active_days_30d: number | null + active_days_7d: number | null + active_days_90d: number | null + avg_daily_depletion_30d: number | null + avg_daily_depletion_7d: number | null + avg_daily_depletion_90d: number | null + avg_days_between_restocks: number | null + current_price: number | null + current_stock: number | null + days_to_stockout: number | null + last_update_date: string | null + price_changes_30d: number | null + product_id: string | null + refreshed_at: string | null + restock_events_30d: number | null + supplier_branch_id: string | null + supplier_id: string | null + total_depleted_30d: number | null + total_depleted_7d: number | null + total_depleted_90d: number | null + total_restocked_30d: number | null + variant_id: string | null + variant_supplier_source_id: string | null + velocity_trend: number | null + } + Relationships: [] + } + products_with_materials: { + Row: { + created_at: string | null + material_added_at: string | null + material_group: string | null + material_id: string | null + material_name: string | null + organization_id: string | null + part: string | null + percentage: number | null + product_id: string | null + product_name: string | null + sort_order: number | null + } + Relationships: [ + { + foreignKeyName: "products_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + ] + } + v_ai_description_queue_stats: { + Row: { + last_completed: string | null + media_tentativas: number | null + oldest_queued: string | null + pct: number | null + quantidade: number | null + status: string | null + } + Relationships: [] + } + v_ai_function_routing_effective: { + Row: { + fallbacks: Json | null + function_name: string | null + is_active: boolean | null + notes: string | null + primary_active: boolean | null + primary_capabilities: Json | null + primary_cost_input: number | null + primary_cost_output: number | null + primary_display_name: string | null + primary_model: string | null + primary_model_id: string | null + primary_provider_active: boolean | null + primary_provider_id: string | null + primary_provider_slug: string | null + request_overrides: Json | null + required_capabilities: Json | null + routing_id: string | null + updated_at: string | null + updated_by: string | null + } + Relationships: [] + } + v_audit_cobertura_tecnicas: { + Row: { + archive: number | null + ativas_camiseta: number | null + ativas_caneta: number | null + ativas_cilindrico: number | null + ativas_mochila: number | null + ativas_sacochila: number | null + ativas_sacola: number | null + catalogo_ativo: boolean | null + grupo: string | null + grupo_nome: string | null + legacy: number | null + revivable: number | null + status: string | null + tabelas_ativas: number | null + tabelas_inativas: number | null + } + Relationships: [] + } + v_audit_paradoxos_gravacao: { + Row: { + codigo_tabela: string | null + economia_cliente_se_subir_faixa: number | null + grupo_tecnica: string | null + nome: string | null + preco_anterior: number | null + preco_atual: number | null + qty_inicio: number | null + qty_pico_ant: number | null + status_natural: string | null + venda_inicio: number | null + venda_no_pico: number | null + } + Relationships: [ + { + foreignKeyName: "fk_oficial_grupo_tecnica" + columns: ["grupo_tecnica"] + isOneToOne: false + referencedRelation: "tecnicas_gravacao" + referencedColumns: ["codigo"] + }, + { + foreignKeyName: "fk_oficial_grupo_tecnica" + columns: ["grupo_tecnica"] + isOneToOne: false + referencedRelation: "v_audit_cobertura_tecnicas" + referencedColumns: ["grupo"] + }, + ] + } + v_category_keywords: { + Row: { + category_id: string | null + category_name: string | null + full_path_readable: string | null + level: number | null + token: string | null + } + Relationships: [] + } + v_commemorative_dates_calendar: { + Row: { + campaign_start_days: number | null + category: string | null + color_hex: string | null + date_day: number | null + date_month: number | null + formatted_date: string | null + icon_name: string | null + id: string | null + is_featured: boolean | null + is_fixed_date: boolean | null + month_name: string | null + name: string | null + product_count: number | null + slug: string | null + target_audience: string | null + variable_date_rule: string | null + } + Insert: { + campaign_start_days?: number | null + category?: string | null + color_hex?: string | null + date_day?: number | null + date_month?: number | null + formatted_date?: never + icon_name?: string | null + id?: string | null + is_featured?: boolean | null + is_fixed_date?: boolean | null + month_name?: never + name?: string | null + product_count?: never + slug?: string | null + target_audience?: string | null + variable_date_rule?: string | null + } + Update: { + campaign_start_days?: number | null + category?: string | null + color_hex?: string | null + date_day?: number | null + date_month?: number | null + formatted_date?: never + icon_name?: string | null + id?: string | null + is_featured?: boolean | null + is_fixed_date?: boolean | null + month_name?: never + name?: string | null + product_count?: never + slug?: string | null + target_audience?: string | null + variable_date_rule?: string | null + } + Relationships: [] + } + v_commemorative_dates_with_colors: { + Row: { + associated_colors: Json | null + campaign_start_days: number | null + category: string | null + color_count: number | null + date_color: string | null + date_day: number | null + date_month: number | null + exclusion_count: number | null + icon_name: string | null + id: string | null + is_active: boolean | null + is_featured: boolean | null + is_fixed_date: boolean | null + name: string | null + slug: string | null + } + Insert: { + associated_colors?: never + campaign_start_days?: number | null + category?: string | null + color_count?: never + date_color?: string | null + date_day?: number | null + date_month?: number | null + exclusion_count?: never + icon_name?: string | null + id?: string | null + is_active?: boolean | null + is_featured?: boolean | null + is_fixed_date?: boolean | null + name?: string | null + slug?: string | null + } + Update: { + associated_colors?: never + campaign_start_days?: number | null + category?: string | null + color_count?: never + date_color?: string | null + date_day?: number | null + date_month?: number | null + exclusion_count?: never + icon_name?: string | null + id?: string | null + is_active?: boolean | null + is_featured?: boolean | null + is_fixed_date?: boolean | null + name?: string | null + slug?: string | null + } + Relationships: [] + } + v_enrichment_stats: { + Row: { + avg_email_confidence: number | null + avg_phone_confidence: number | null + complete_enrichments: number | null + email_find_rate: number | null + partial_enrichments: number | null + phone_find_rate: number | null + total_contacts: number | null + total_emails_found: number | null + total_phones_found: number | null + } + Relationships: [] + } + v_image_quality_stats: { + Row: { + "<800px": number | null + ">=1200px": number | null + "800-1199px": number | null + fornecedor: string | null + media_altura_px: number | null + media_largura_px: number | null + media_mb: number | null + pct_otimas: number | null + sem_info: number | null + total: number | null + } + Relationships: [] + } + v_image_types_complete: { + Row: { + category: string | null + code: string | null + description: string | null + display_priority: number | null + gallery_order: number | null + icon: string | null + id: string | null + is_active: boolean | null + is_color_specific: boolean | null + is_primary_candidate: boolean | null + name: string | null + name_en: string | null + requires_variant: boolean | null + show_in_gallery: boolean | null + show_in_simulator: boolean | null + subcategory: string | null + supplier_codes: Json | null + suppliers_count: number | null + } + Insert: { + category?: string | null + code?: string | null + description?: string | null + display_priority?: number | null + gallery_order?: number | null + icon?: string | null + id?: string | null + is_active?: boolean | null + is_color_specific?: boolean | null + is_primary_candidate?: boolean | null + name?: string | null + name_en?: string | null + requires_variant?: boolean | null + show_in_gallery?: boolean | null + show_in_simulator?: boolean | null + subcategory?: string | null + supplier_codes?: never + suppliers_count?: never + } + Update: { + category?: string | null + code?: string | null + description?: string | null + display_priority?: number | null + gallery_order?: number | null + icon?: string | null + id?: string | null + is_active?: boolean | null + is_color_specific?: boolean | null + is_primary_candidate?: boolean | null + name?: string | null + name_en?: string | null + requires_variant?: boolean | null + show_in_gallery?: boolean | null + show_in_simulator?: boolean | null + subcategory?: string | null + supplier_codes?: never + suppliers_count?: never + } + Relationships: [] + } + v_image_validation_recent: { + Row: { + acao: string | null + dimensoes: string | null + filename: string | null + fornecedor: string | null + problemas: string[] | null + produto: string | null + recomendacoes: string[] | null + status: string | null + tamanho_mb: number | null + validated_at: string | null + } + Relationships: [] + } + v_images_below_requirements: { + Row: { + filename: string | null + format: string | null + height_px: number | null + id: string | null + ideal_req: string | null + minimo_req: string | null + product_id: string | null + size_mb: number | null + status: string | null + supplier_code: string | null + width_px: number | null + } + Relationships: [ + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + v_import_staging_by_product: { + Row: { + already_exists: number | null + completed: number | null + errors: number | null + parsed_sku: string | null + pending: number | null + product_name: string | null + total_images: number | null + } + Relationships: [] + } + v_import_staging_progress: { + Row: { + percentual: number | null + status: string | null + total: number | null + } + Relationships: [] + } + v_kill_switch_hits_summary: { + Row: { + hits: number | null + hits_1h: number | null + hits_24h: number | null + hits_7d: number | null + last_hit: string | null + operation: string | null + source: string | null + switch_name: string | null + target: string | null + } + Relationships: [] + } + v_kit_max_quantity: { + Row: { + componente_gargalo: string | null + componentes_com_estoque: number | null + kit_id: string | null + kit_name: string | null + kit_sku: string | null + max_kits_possiveis: number | null + total_componentes: number | null + } + Relationships: [] + } + v_kit_with_components: { + Row: { + allows_personalization: boolean | null + color: string | null + component_code: string | null + component_description: string | null + component_id: string | null + component_image: string | null + component_name: string | null + component_sku: string | null + display_order: number | null + height_mm: number | null + is_optional: boolean | null + kit_description: string | null + kit_id: string | null + kit_image: string | null + kit_name: string | null + kit_sku: string | null + length_mm: number | null + material: string | null + personalization_notes: string | null + quantity: number | null + supplier_component_code: string | null + weight_g: number | null + width_mm: number | null + } + Relationships: [] + } + v_media_combined: { + Row: { + cloudflare_image_id: string | null + color_id: string | null + display_order: number | null + image_type: string | null + is_primary: boolean | null + media_asset_id: string | null + product_id: string | null + product_image_id: string | null + product_name: string | null + supplier_code: string | null + supplier_product_ref: string | null + supplier_source_url: string | null + supplier_variant_sku: string | null + sync_error: string | null + sync_processed_at: string | null + sync_status: string | null + url_cdn: string | null + variant_id: string | null + } + Relationships: [ + { + foreignKeyName: "product_images_color_id_fkey" + columns: ["color_id"] + isOneToOne: false + referencedRelation: "color_variations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_color_id_fkey" + columns: ["color_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["promo_variation_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "product_variants" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "product_images_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "product_images_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_variant_sale_prices" + referencedColumns: ["variant_id"] + }, + ] + } + v_media_migration_progress: { + Row: { + migrated: number | null + pending: number | null + progress_pct: number | null + supplier_code: string | null + total: number | null + } + Relationships: [] + } + v_media_statistics: { + Row: { + categoria: string | null + modulo: string | null + percentual: number | null + produtos_distintos: number | null + quantidade: number | null + tamanho_mb: number | null + tipo_code: string | null + tipo_nome: string | null + } + Relationships: [] + } + v_media_stats: { + Row: { + count_gallery: number | null + count_logo: number | null + count_main: number | null + count_set: number | null + media_type: string | null + products_with_media: number | null + total_bytes: number | null + total_count: number | null + total_size_formatted: string | null + } + Relationships: [] + } + v_media_sync_queue_stats: { + Row: { + com_url_origem: number | null + last_completed: string | null + media_tentativas: number | null + oldest_queued: string | null + pct: number | null + quantidade: number | null + status: string | null + } + Relationships: [] + } + v_monthly_costs: { + Row: { + avg_response_ms: number | null + month: string | null + provider_name: string | null + successful_calls: number | null + total_calls: number | null + total_cost: number | null + } + Relationships: [] + } + v_n8n_sync_errors: { + Row: { + created_at: string | null + error_message: string | null + id: string | null + media_type: string | null + product_id: string | null + retry_count: number | null + source_url: string | null + sync_type: string | null + } + Relationships: [ + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + v_n8n_sync_success_recent: { + Row: { + cloudflare_id: string | null + created_at: string | null + destination_url: string | null + file_size_bytes: number | null + id: string | null + media_type: string | null + processing_time_ms: number | null + product_id: string | null + sync_type: string | null + } + Relationships: [ + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "media_sync_log_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + v_n8n_sync_summary: { + Row: { + metric: string | null + value: string | null + } + Relationships: [] + } + v_needs_enrichment: { + Row: { + company_domain: string | null + current_company: string | null + enrichment_status: string | null + first_name: string | null + id: string | null + last_enriched_at: string | null + last_name: string | null + } + Insert: { + company_domain?: string | null + current_company?: string | null + enrichment_status?: string | null + first_name?: string | null + id?: string | null + last_enriched_at?: string | null + last_name?: string | null + } + Update: { + company_domain?: string | null + current_company?: string | null + enrichment_status?: string | null + first_name?: string | null + id?: string | null + last_enriched_at?: string | null + last_name?: string | null + } + Relationships: [] + } + v_performance_dashboard: { + Row: { + métrica: string | null + valor: string | null + } + Relationships: [] + } + v_pipeline_next_step: { + Row: { + comando_resumo: string | null + completed_at: string | null + created_at: string | null + dependencia: number[] | null + descricao: string | null + error_message: string | null + etapa: number | null + fase: string | null + id: number | null + resultado: Json | null + started_at: string | null + status: string | null + titulo: string | null + updated_at: string | null + } + Relationships: [] + } + v_pipeline_progress: { + Row: { + com_erro: number | null + concluidas: number | null + em_andamento: number | null + fase: string | null + pct_completo: number | null + pendentes: number | null + puladas: number | null + total_etapas: number | null + } + Relationships: [] + } + v_product_images_cdn: { + Row: { + applies_to_color: boolean | null + cloudflare_image_id: string | null + color_id: string | null + created_at: string | null + display_order: number | null + display_priority: number | null + file_size_bytes: number | null + filename: string | null + format: string | null + gallery_order: number | null + height_px: number | null + id: string | null + image_type: string | null + image_type_category: string | null + image_type_name: string | null + is_active: boolean | null + is_primary: boolean | null + product_id: string | null + product_name: string | null + product_sku: string | null + show_in_gallery: boolean | null + show_in_simulator: boolean | null + source_supplier: string | null + supplier_code: string | null + updated_at: string | null + url_cdn: string | null + url_large: string | null + url_medium: string | null + url_original: string | null + url_public: string | null + url_small: string | null + url_thumbnail: string | null + variant_id: string | null + width_px: number | null + } + Relationships: [ + { + foreignKeyName: "product_images_color_id_fkey" + columns: ["color_id"] + isOneToOne: false + referencedRelation: "color_variations" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_color_id_fkey" + columns: ["color_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["promo_variation_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "product_variants" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_images_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "product_images_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["variant_id"] + }, + { + foreignKeyName: "product_images_variant_id_fkey" + columns: ["variant_id"] + isOneToOne: false + referencedRelation: "vw_variant_sale_prices" + referencedColumns: ["variant_id"] + }, + ] + } + v_product_tokens: { + Row: { + product_id: string | null + product_name: string | null + token: string | null + } + Relationships: [] + } + v_product_videos_cdn: { + Row: { + cloudflare_video_id: string | null + description: string | null + display_order: number | null + duration_seconds: number | null + filename: string | null + height_px: number | null + id: string | null + is_primary: boolean | null + prod_id: string | null + product_id: string | null + product_name: string | null + source_supplier: string | null + source_youtube_id: string | null + title: string | null + url_dash: string | null + url_embed: string | null + url_hls: string | null + url_stream: string | null + url_thumbnail: string | null + url_watch: string | null + video_type: string | null + width_px: number | null + } + Relationships: [ + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + v_products_complete: { + Row: { + category_id: string | null + category_level: number | null + category_name: string | null + category_path: string | null + cost_price: number | null + created_at: string | null + description: string | null + materials_count: number | null + materials_list: string | null + organization_id: string | null + parent_category_name: string | null + product_active: boolean | null + product_id: string | null + product_name: string | null + secondary_categories_count: number | null + sku: string | null + updated_at: string | null + } + Relationships: [ + { + foreignKeyName: "products_organization_id_fkey" + columns: ["organization_id"] + isOneToOne: false + referencedRelation: "organizations" + referencedColumns: ["id"] + }, + ] + } + v_products_images_summary: { + Row: { + colors_with_images: number | null + image_types_available: string | null + primary_images: number | null + primary_thumbnail_url: string | null + product_id: string | null + product_name: string | null + total_images: number | null + } + Relationships: [] + } + v_products_kit_builder: { + Row: { + colors: Json | null + cost_price: number | null + description: string | null + dimensions_display: string | null + height_cm: number | null + id: string | null + images: Json | null + internal_height_cm: number | null + internal_length_cm: number | null + internal_width_cm: number | null + is_active: boolean | null + length_cm: number | null + name: string | null + product_type: string | null + sku: string | null + stock_quantity: number | null + volume_liters: number | null + width_cm: number | null + } + Insert: { + colors?: Json | null + cost_price?: number | null + description?: string | null + dimensions_display?: never + height_cm?: number | null + id?: string | null + images?: Json | null + internal_height_cm?: number | null + internal_length_cm?: number | null + internal_width_cm?: number | null + is_active?: boolean | null + length_cm?: number | null + name?: string | null + product_type?: string | null + sku?: string | null + stock_quantity?: number | null + volume_liters?: never + width_cm?: number | null + } + Update: { + colors?: Json | null + cost_price?: number | null + description?: string | null + dimensions_display?: never + height_cm?: number | null + id?: string | null + images?: Json | null + internal_height_cm?: number | null + internal_length_cm?: number | null + internal_width_cm?: number | null + is_active?: boolean | null + length_cm?: number | null + name?: string | null + product_type?: string | null + sku?: string | null + stock_quantity?: number | null + volume_liters?: never + width_cm?: number | null + } + Relationships: [] + } + v_products_min_price: { + Row: { + max_price: number | null + min_price: number | null + name: string | null + product_id: string | null + sku: string | null + variants_count: number | null + } + Relationships: [] + } + v_products_missing_primary_image: { + Row: { + created_at: string | null + is_active: boolean | null + product_id: string | null + product_name: string | null + total_images: number | null + } + Insert: { + created_at?: string | null + is_active?: boolean | null + product_id?: string | null + product_name?: string | null + total_images?: never + } + Update: { + created_at?: string | null + is_active?: boolean | null + product_id?: string | null + product_name?: string | null + total_images?: never + } + Relationships: [] + } + v_products_with_tags: { + Row: { + name: string | null + product_id: string | null + sku: string | null + tag_names: string[] | null + tag_slugs: string[] | null + } + Relationships: [] + } + v_products_without_images: { + Row: { + created_at: string | null + is_active: boolean | null + product_id: string | null + product_name: string | null + } + Insert: { + created_at?: string | null + is_active?: boolean | null + product_id?: string | null + product_name?: string | null + } + Update: { + created_at?: string | null + is_active?: boolean | null + product_id?: string | null + product_name?: string | null + } + Relationships: [] + } + v_products_without_video: { + Row: { + created_at: string | null + is_active: boolean | null + name: string | null + product_id: string | null + sku: string | null + } + Insert: { + created_at?: string | null + is_active?: boolean | null + name?: string | null + product_id?: string | null + sku?: string | null + } + Update: { + created_at?: string | null + is_active?: boolean | null + name?: string | null + product_id?: string | null + sku?: string | null + } + Relationships: [] + } + v_slow_queries_analysis: { + Row: { + calls: number | null + mean_ms: number | null + pct_total_load: number | null + query_preview: string | null + rows: number | null + severity: string | null + stddev_ms: number | null + total_ms_acumulado: number | null + } + Relationships: [] + } + v_supplier_coverage: { + Row: { + mapeamentos_configurados: number | null + sufixos: string | null + supplier_code: string | null + tipos_mapeados: number | null + } + Relationships: [] + } + v_supplier_suffix_mappings_complete: { + Row: { + confidence_score: number | null + display_priority: number | null + example_filename: string | null + example_url: string | null + file_format: string | null + gallery_order: number | null + images_count: number | null + internal_category: string | null + internal_type_code: string | null + internal_type_name: string | null + is_active: boolean | null + is_color_specific: boolean | null + is_validated: boolean | null + mapping_id: string | null + suffix_regex: string | null + supplier_code: string | null + supplier_pattern: string | null + supplier_pattern_name: string | null + } + Relationships: [] + } + v_system_alerts: { + Row: { + codigo: string | null + detalhe: string | null + detected_at: string | null + mensagem: string | null + severidade: string | null + } + Relationships: [] + } + v_system_health_dashboard: { + Row: { + captured_at: string | null + categoria: string | null + metrica: string | null + unit: string | null + valor: string | null + } + Relationships: [] + } + v_top_patterns: { + Row: { + avg_confidence: number | null + example_domains: string[] | null + pattern_format: string | null + usage_count: number | null + } + Relationships: [] + } + v_unmapped_images: { + Row: { + exemplos_arquivos: string[] | null + quantidade: number | null + supplier_code: string | null + tipo_detectado: string | null + } + Relationships: [] + } + v_variants_with_commemorative_dates: { + Row: { + color_hex: string | null + color_name: string | null + commemorative_date_id: string | null + commemorative_date_name: string | null + commemorative_date_slug: string | null + custom_description: string | null + date_category: string | null + date_color: string | null + date_day: number | null + date_icon: string | null + date_month: number | null + is_featured: boolean | null + is_product_wide: boolean | null + product_id: string | null + product_name: string | null + product_sku: string | null + variant_id: string | null + variant_name: string | null + variant_sku: string | null + } + Relationships: [] + } + v_video_dashboard: { + Row: { + duracao_media_seg: number | null + duracao_total_seg: number | null + full_hd: number | null + hd: number | null + produtos: number | null + quantidade: number | null + sd_ou_desconhecido: number | null + status: string | null + tipo: string | null + } + Relationships: [] + } + v_video_validation_recent: { + Row: { + action_type: string | null + cloudflare_video_id: string | null + duracao: string | null + issues: string[] | null + produto: string | null + recommendations: string[] | null + resolucao: string | null + supplier_code: string | null + validated_at: string | null + validation_status: string | null + } + Relationships: [] + } + v_videos_pending: { + Row: { + cloudflare_error: string | null + cloudflare_status: string | null + cloudflare_video_id: string | null + created_at: string | null + id: string | null + product_name: string | null + sku: string | null + } + Relationships: [] + } + v_videos_with_urls: { + Row: { + cloudflare_status: string | null + cloudflare_video_id: string | null + duration_formatted: string | null + duration_seconds: number | null + embed_url: string | null + gif_preview_url: string | null + height_px: number | null + hls_url: string | null + id: string | null + is_active: boolean | null + is_primary: boolean | null + product_id: string | null + product_name: string | null + resolution: string | null + sku: string | null + thumbnail_url: string | null + title: string | null + video_type: string | null + width_px: number | null + } + Relationships: [ + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fk_pv_product_id" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_videos_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + vw_asia_products_by_category: { + Row: { + com_estoque: number | null + estoque_total: number | null + id_categoria_asia: string | null + nome_categoria: string | null + pendentes: number | null + preco_maximo: number | null + preco_medio: number | null + preco_minimo: number | null + processados: number | null + total_produtos: number | null + } + Relationships: [] + } + vw_asia_products_by_color: { + Row: { + estoque_total: number | null + hex_cor: string | null + nome_cor: string | null + preco_medio: number | null + slug_cor: string | null + total_produtos: number | null + } + Relationships: [] + } + vw_asia_products_by_tag: { + Row: { + estoque_total: number | null + id_tag_asia: string | null + nome_tag: string | null + preco_medio: number | null + total_produtos: number | null + } + Relationships: [] + } + vw_asia_products_errors: { + Row: { + created_at: string | null + nome_produto: string | null + process_errors: Json | null + processed: boolean | null + processed_at: string | null + supplier_reference: string | null + } + Insert: { + created_at?: string | null + nome_produto?: never + process_errors?: Json | null + processed?: boolean | null + processed_at?: string | null + supplier_reference?: string | null + } + Update: { + created_at?: string | null + nome_produto?: never + process_errors?: Json | null + processed?: boolean | null + processed_at?: string | null + supplier_reference?: string | null + } + Relationships: [] + } + vw_asia_products_low_stock: { + Row: { + categorias: Json | null + estoque_atual: number | null + nome_produto: string | null + preco: number | null + supplier_reference: string | null + updated_at: string | null + } + Insert: { + categorias?: never + estoque_atual?: never + nome_produto?: never + preco?: never + supplier_reference?: string | null + updated_at?: string | null + } + Update: { + categorias?: never + estoque_atual?: never + nome_produto?: never + preco?: never + supplier_reference?: string | null + updated_at?: string | null + } + Relationships: [] + } + vw_asia_products_pending: { + Row: { + categorias: Json | null + created_at: string | null + estoque: number | null + horas_desde_import: number | null + imported_at: string | null + nome_produto: string | null + preco: number | null + supplier_reference: string | null + } + Insert: { + categorias?: never + created_at?: string | null + estoque?: never + horas_desde_import?: never + imported_at?: string | null + nome_produto?: never + preco?: never + supplier_reference?: string | null + } + Update: { + categorias?: never + created_at?: string | null + estoque?: never + horas_desde_import?: never + imported_at?: string | null + nome_produto?: never + preco?: never + supplier_reference?: string | null + } + Relationships: [] + } + vw_asia_products_promo: { + Row: { + categorias: Json | null + estoque: number | null + nome_produto: string | null + preco: number | null + supplier_reference: string | null + updated_at: string | null + } + Insert: { + categorias?: never + estoque?: never + nome_produto?: never + preco?: never + supplier_reference?: string | null + updated_at?: string | null + } + Update: { + categorias?: never + estoque?: never + nome_produto?: never + preco?: never + supplier_reference?: string | null + updated_at?: string | null + } + Relationships: [] + } + vw_asia_products_stats: { + Row: { + com_estoque: number | null + com_galeria: number | null + com_video: number | null + estoque_total: number | null + preco_maximo: number | null + preco_medio: number | null + preco_minimo: number | null + primeira_importacao: string | null + produtos_pendentes: number | null + produtos_processados: number | null + sem_estoque: number | null + taxa_processamento_pct: number | null + total_produtos: number | null + ultima_atualizacao: string | null + ultimo_import: string | null + } + Relationships: [] + } + vw_category_accessories: { + Row: { + accessory_category_id: string | null + accessory_category_name: string | null + accessory_path: string | null + display_label: string | null + include_children: boolean | null + is_required: boolean | null + product_category_id: string | null + product_category_name: string | null + relationship_type: string | null + } + Relationships: [] + } + vw_category_commemorative_dates: { + Row: { + category_id: string | null + category_name: string | null + custom_message: string | null + date_day: number | null + date_id: string | null + date_month: number | null + date_name: string | null + is_primary: boolean | null + relevance_score: number | null + target_audience: string | null + } + Relationships: [] + } + vw_category_target_audiences: { + Row: { + audience_name: string | null + audience_slug: string | null + audience_type: string | null + category_id: string | null + category_name: string | null + created_at: string | null + display_order: number | null + id: string | null + is_active: boolean | null + is_primary: boolean | null + relevance_score: number | null + target_audience_id: string | null + } + Relationships: [ + { + foreignKeyName: "category_target_audiences_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "category_target_audiences_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_target_audiences_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_target_audiences_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "category_target_audiences_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "category_target_audiences_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "category_target_audiences_target_audience_id_fkey" + columns: ["target_audience_id"] + isOneToOne: false + referencedRelation: "target_audiences" + referencedColumns: ["id"] + }, + ] + } + vw_category_variation_types: { + Row: { + category_id: string | null + category_level: number | null + category_name: string | null + display_order: number | null + is_inherited: boolean | null + is_required: boolean | null + variation_code: string | null + variation_name: string | null + variation_type_id: string | null + } + Relationships: [] + } + vw_classify_functions_status: { + Row: { + description: string | null + function_name: string | null + is_field: string | null + priority: number | null + status: string | null + updated_at: string | null + } + Insert: { + description?: string | null + function_name?: string | null + is_field?: string | null + priority?: number | null + status?: never + updated_at?: string | null + } + Update: { + description?: string | null + function_name?: string | null + is_field?: string | null + priority?: number | null + status?: never + updated_at?: string | null + } + Relationships: [] + } + vw_component_types_usage: { + Row: { + category: string | null + code: string | null + default_material: string | null + icon: string | null + kits_count: number | null + name: string | null + secondary_material: string | null + typical_dimensions: string | null + typical_weight_g: number | null + usage_count: number | null + } + Relationships: [] + } + vw_duplicate_images: { + Row: { + cloudflare_image_id: string | null + duplicatas: number | null + image_ids: string[] | null + product_ids: string[] | null + } + Relationships: [] + } + vw_media_stats_by_type: { + Row: { + avg_file_size: number | null + categoria: string | null + com_color: number | null + com_seo: number | null + com_variant: number | null + primeira_importacao: string | null + produtos_distintos: number | null + tipo: string | null + tipo_nome: string | null + total: number | null + ultima_importacao: string | null + } + Relationships: [] + } + vw_packaging_suppliers: { + Row: { + currency: string | null + dimensoes: string | null + is_available: boolean | null + lead_time_days: number | null + min_order_quantity: number | null + packaging_code: string | null + packaging_id: string | null + packaging_name: string | null + packaging_type: string | null + supplier_code: string | null + supplier_id: string | null + supplier_name: string | null + unit_price: number | null + } + Relationships: [] + } + vw_packagings_catalog: { + Row: { + cost_price: number | null + ext_height: number | null + ext_length: number | null + ext_width: number | null + fornecedor: string | null + has_inner_cradle: boolean | null + id: string | null + internal_height_cm: number | null + internal_length_cm: number | null + internal_width_cm: number | null + name: string | null + packaging_color: string | null + packaging_material: string | null + qtd_produtos_compativeis: number | null + sku: string | null + supplier_id: string | null + supplier_reference: string | null + weight_g: number | null + } + Relationships: [ + { + foreignKeyName: "products_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "products_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "products_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "products_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + vw_product_all_packaging_options: { + Row: { + can_be_customized: boolean | null + can_be_disabled: boolean | null + embalagem_cor: string | null + embalagem_id: string | null + embalagem_material: string | null + embalagem_nome: string | null + embalagem_peso_g: number | null + embalagem_sku: string | null + external_height_cm: number | null + external_length_cm: number | null + external_width_cm: number | null + fit_rating: string | null + folga_minima_mm: number | null + internal_height_cm: number | null + internal_length_cm: number | null + internal_width_cm: number | null + is_recommended: boolean | null + mesmo_fornecedor: boolean | null + ordem_exibicao: number | null + preco_adicional: number | null + preco_info: string | null + product_id: string | null + product_name: string | null + product_sku: string | null + tem_berco: boolean | null + tipo_embalagem: string | null + } + Relationships: [] + } + vw_product_color_category_links: { + Row: { + category_slug: string | null + color_group_id: string | null + color_group_name: string | null + color_hex: string | null + color_name: string | null + is_primary: boolean | null + link_created_at: string | null + linked_category: string | null + product_id: string | null + product_name: string | null + sku: string | null + variant_id: string | null + variant_sku: string | null + } + Relationships: [ + { + foreignKeyName: "color_variations_group_id_fkey" + columns: ["color_group_id"] + isOneToOne: false + referencedRelation: "color_groups" + referencedColumns: ["id"] + }, + { + foreignKeyName: "color_variations_group_id_fkey" + columns: ["color_group_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["promo_group_id"] + }, + ] + } + vw_product_commemorative_dates: { + Row: { + date_day: number | null + date_id: string | null + date_month: number | null + date_name: string | null + is_featured: boolean | null + product_id: string | null + product_name: string | null + relevance_score: number | null + sku: string | null + source: string | null + target_audience: string | null + } + Relationships: [] + } + vw_product_packaging_options: { + Row: { + additional_price: number | null + external_height_cm: number | null + external_length_cm: number | null + external_width_cm: number | null + internal_height_cm: number | null + internal_length_cm: number | null + internal_width_cm: number | null + packaging_id: string | null + packaging_name: string | null + packaging_type: string | null + product_id: string | null + product_name: string | null + product_ref: string | null + relationship_display: string | null + relationship_type: string | null + suppliers_count: number | null + } + Relationships: [] + } + vw_products_ai_status: { + Row: { + ai_generated_at: string | null + ai_model: string | null + ai_status: string | null + ai_version: number | null + category_name: string | null + description_length: number | null + has_raw_data: boolean | null + id: string | null + name: string | null + sku: string | null + title_length: number | null + } + Relationships: [] + } + vw_products_by_date: { + Row: { + campaign_end_days: number | null + campaign_start_days: number | null + category_name: string | null + date_day: number | null + date_id: string | null + date_month: number | null + date_name: string | null + is_featured: boolean | null + product_id: string | null + product_name: string | null + relevance_score: number | null + sku: string | null + target_audience: string | null + } + Relationships: [] + } + vw_products_by_property_category: { + Row: { + category: string | null + product_count: number | null + properties_in_category: string[] | null + property_count: number | null + } + Relationships: [] + } + vw_products_commercial_packing: { + Row: { + category_id: string | null + category_name: string | null + category_slug: string | null + cost_price: number | null + has_gift_box: boolean | null + id: string | null + image_url: string | null + is_active: boolean | null + is_gift_ready: boolean | null + is_new: boolean | null + name: string | null + packing_classification: string | null + packing_icon: string | null + packing_type: string | null + sale_price: number | null + sku: string | null + slug: string | null + supplier_id: string | null + supplier_name: string | null + } + Relationships: [ + { + foreignKeyName: "products_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "products_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "products_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "products_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "products_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "products_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "products_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "products_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "products_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "products_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + vw_products_min_quantity: { + Row: { + category_id: string | null + category_min: number | null + category_name: string | null + effective_min_quantity: number | null + id: string | null + is_active: boolean | null + min_quantity_source: string | null + name: string | null + product_override: number | null + sale_price: number | null + sku: string | null + } + Relationships: [ + { + foreignKeyName: "products_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] + }, + { + foreignKeyName: "products_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_category_keywords" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "products_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["category_id"] + }, + { + foreignKeyName: "products_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["accessory_category_id"] + }, + { + foreignKeyName: "products_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_accessories" + referencedColumns: ["product_category_id"] + }, + { + foreignKeyName: "products_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "vw_category_commemorative_dates" + referencedColumns: ["category_id"] + }, + ] + } + vw_products_packaging_info: { + Row: { + active: boolean | null + cost_price: number | null + diameter_cm: number | null + dimensoes: string | null + fornecedor: string | null + height_cm: number | null + id: string | null + length_cm: number | null + name: string | null + product_type: string | null + qtd_compativeis: number | null + qtd_inclusas: number | null + shape_type: string | null + sku: string | null + supplier_id: string | null + supplier_reference: string | null + tem_embalagem_inclusa: boolean | null + weight_g: number | null + width_cm: number | null + } + Relationships: [ + { + foreignKeyName: "products_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "suppliers" + referencedColumns: ["id"] + }, + { + foreignKeyName: "products_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_packaging_suppliers" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "products_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_color_mappings" + referencedColumns: ["supplier_id"] + }, + { + foreignKeyName: "products_supplier_id_fkey" + columns: ["supplier_id"] + isOneToOne: false + referencedRelation: "vw_supplier_products_raw_status" + referencedColumns: ["supplier_id"] + }, + ] + } + vw_products_seo_status: { + Row: { + description_length: number | null + has_good_description: string | null + has_meta_description: string | null + has_meta_title: string | null + has_slug: string | null + id: string | null + image_count: number | null + images_with_alt: number | null + meta_description_length: number | null + meta_title_length: number | null + name: string | null + seo_last_audit_at: string | null + seo_score: number | null + seo_status: string | null + sku: string | null + slug: string | null + updated_at: string | null + } + Insert: { + description_length?: never + has_good_description?: never + has_meta_description?: never + has_meta_title?: never + has_slug?: never + id?: string | null + image_count?: never + images_with_alt?: never + meta_description_length?: never + meta_title_length?: never + name?: string | null + seo_last_audit_at?: string | null + seo_score?: never + seo_status?: never + sku?: string | null + slug?: string | null + updated_at?: string | null + } + Update: { + description_length?: never + has_good_description?: never + has_meta_description?: never + has_meta_title?: never + has_slug?: never + id?: string | null + image_count?: never + images_with_alt?: never + meta_description_length?: never + meta_title_length?: never + name?: string | null + seo_last_audit_at?: string | null + seo_score?: never + seo_status?: never + sku?: string | null + slug?: string | null + updated_at?: string | null + } + Relationships: [] + } + vw_products_thermal_status: { + Row: { + id: string | null + is_thermal_calculated: boolean | null + is_thermal_stored: boolean | null + name: string | null + sku: string | null + } + Insert: { + id?: string | null + is_thermal_calculated?: never + is_thermal_stored?: boolean | null + name?: string | null + sku?: string | null + } + Update: { + id?: string | null + is_thermal_calculated?: never + is_thermal_stored?: boolean | null + name?: string | null + sku?: string | null + } + Relationships: [] + } + vw_products_with_properties: { + Row: { + has_premium_properties: boolean | null + has_thermal_properties: boolean | null + id: string | null + is_thermal: boolean | null + name: string | null + properties: string[] | null + property_categories: string[] | null + property_codes: string[] | null + property_count: number | null + sku: string | null + supplier_reference: string | null + } + Relationships: [] + } + vw_property_statistics: { + Row: { + category: string | null + code: string | null + display_order: number | null + icon_code: string | null + is_thermal_indicator: boolean | null + name_pt: string | null + product_count: number | null + } + Relationships: [] + } + vw_seo_dashboard: { + Row: { + distribuicao_scores: string | null + entidade: string | null + pct_com_meta_description: number | null + pct_com_meta_title: number | null + pct_com_slug: number | null + score_medio: number | null + total: number | null + } + Relationships: [] + } + vw_sitemap_all: { + Row: { + changefreq: string | null + identifier: string | null + image_url: string | null + lastmod: string | null + priority: number | null + title: string | null + url_path: string | null + url_type: string | null + } + Relationships: [] + } + vw_sitemap_categories: { + Row: { + changefreq: string | null + identifier: string | null + image_url: string | null + lastmod: string | null + priority: number | null + products_count: number | null + title: string | null + title_seo: string | null + url_path: string | null + url_type: string | null + } + Insert: { + changefreq?: never + identifier?: string | null + image_url?: string | null + lastmod?: string | null + priority?: never + products_count?: number | null + title?: string | null + title_seo?: never + url_path?: never + url_type?: never + } + Update: { + changefreq?: never + identifier?: string | null + image_url?: string | null + lastmod?: string | null + priority?: never + products_count?: number | null + title?: string | null + title_seo?: never + url_path?: never + url_type?: never + } + Relationships: [] + } + vw_sitemap_products: { + Row: { + changefreq: string | null + identifier: string | null + image_title: string | null + image_url: string | null + lastmod: string | null + priority: number | null + seo_score: number | null + title: string | null + url_path: string | null + url_type: string | null + } + Insert: { + changefreq?: never + identifier?: never + image_title?: never + image_url?: string | null + lastmod?: string | null + priority?: never + seo_score?: never + title?: string | null + url_path?: never + url_type?: never + } + Update: { + changefreq?: never + identifier?: never + image_title?: never + image_url?: string | null + lastmod?: string | null + priority?: never + seo_score?: never + title?: string | null + url_path?: never + url_type?: never + } + Relationships: [] + } + vw_somarcas_materials: { + Row: { + estoque: number | null + material: string | null + total: number | null + } + Relationships: [] + } + vw_somarcas_pending: { + Row: { + estoque: number | null + id: string | null + imported_at: string | null + preco: number | null + sku: string | null + titulo: string | null + } + Insert: { + estoque?: never + id?: string | null + imported_at?: string | null + preco?: never + sku?: string | null + titulo?: never + } + Update: { + estoque?: never + id?: string | null + imported_at?: string | null + preco?: never + sku?: string | null + titulo?: never + } + Relationships: [] + } + vw_somarcas_stats: { + Row: { + ativos: number | null + com_estoque: number | null + estoque_total: number | null + pendentes: number | null + preco_max: number | null + preco_medio: number | null + preco_min: number | null + processados: number | null + sem_estoque: number | null + total_produtos: number | null + } + Relationships: [] + } + vw_somarcas_sync_status: { + Row: { + com_erro: number | null + pendentes: number | null + processados: number | null + total_raw: number | null + ultima_importacao: string | null + } + Relationships: [] + } + vw_supplier_color_mappings: { + Row: { + confidence_score: number | null + equivalence_source: string | null + is_mapped: boolean | null + match_quality: string | null + promo_group_id: string | null + promo_group_name: string | null + promo_hex: string | null + promo_internal_code: string | null + promo_name: string | null + promo_variation_id: string | null + supplier_code: string | null + supplier_color_code: string | null + supplier_color_id: string | null + supplier_color_name: string | null + supplier_hex: string | null + supplier_id: string | null + supplier_name: string | null + verified: boolean | null + } + Relationships: [] + } + vw_supplier_field_mappings_summary: { + Row: { + is_active: boolean | null + priority: number | null + source_field: string | null + source_path: string | null + source_unit: string | null + supplier_code: string | null + supplier_name: string | null + target_field: string | null + target_table: string | null + target_unit: string | null + transform_type: string | null + } + Relationships: [] + } + vw_supplier_mapping_statistics: { + Row: { + categories: string[] | null + supplier_code: string | null + thermal_mappings: number | null + total_mappings: number | null + unique_properties: number | null + } + Relationships: [] + } + vw_supplier_products_raw_errors: { + Row: { + imported_at: string | null + process_errors: Json | null + supplier_name: string | null + supplier_reference: string | null + updated_at: string | null + } + Relationships: [] + } + vw_supplier_products_raw_status: { + Row: { + com_erro: number | null + pendentes: number | null + primeira_importacao: string | null + processados: number | null + supplier_id: string | null + supplier_name: string | null + taxa_sucesso_pct: number | null + tempo_medio_processamento_seg: number | null + total_produtos: number | null + ultima_importacao: string | null + } + Relationships: [] + } + vw_thermal_products: { + Row: { + id: string | null + is_thermal: boolean | null + name: string | null + sku: string | null + supplier_reference: string | null + thermal_codes: string[] | null + thermal_properties: string | null + } + Relationships: [] + } + vw_variant_sale_prices: { + Row: { + color_name: string | null + cost_price_1: number | null + cost_price_2: number | null + cost_price_3: number | null + cost_price_4: number | null + cost_price_5: number | null + markup_percent: number | null + min_qty_1: number | null + min_qty_2: number | null + min_qty_3: number | null + min_qty_4: number | null + min_qty_5: number | null + product_id: string | null + sale_price_1: number | null + sale_price_2: number | null + sale_price_3: number | null + sale_price_4: number | null + sale_price_5: number | null + sku: string | null + variant_id: string | null + } + Relationships: [ + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "products_with_materials" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_max_quantity" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_kit_with_components" + referencedColumns: ["kit_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_tokens" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_product_videos_cdn" + referencedColumns: ["prod_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_complete" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_images_summary" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_kit_builder" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_min_price" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_missing_primary_image" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_with_tags" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_images" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_products_without_video" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "v_variants_with_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_packagings_catalog" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_color_category_links" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_commemorative_dates" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_product_packaging_options" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_ai_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_by_date" + referencedColumns: ["product_id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_commercial_packing" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_min_quantity" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_packaging_info" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_seo_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_thermal_status" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_products_with_properties" + referencedColumns: ["id"] + }, + { + foreignKeyName: "product_variants_product_id_fkey" + columns: ["product_id"] + isOneToOne: false + referencedRelation: "vw_thermal_products" + referencedColumns: ["id"] + }, + ] + } + vw_xbz_products_by_category: { + Row: { + categoria: string | null + preco_medio: number | null + subcategoria: string | null + total_produtos: number | null + } + Relationships: [] + } + vw_xbz_products_by_color: { + Row: { + cor: string | null + preco_medio: number | null + total_produtos: number | null + } + Relationships: [] + } + vw_xbz_products_stats: { + Row: { + categorias_distintas: number | null + com_product_id: number | null + cores_distintas: number | null + pendentes: number | null + primeiro_import: string | null + processados: number | null + total_produtos: number | null + ultimo_update: string | null + } + Relationships: [] + } + } + Functions: { + _can_act_on_behalf_of_others: { Args: never; Returns: boolean } + _get_user_primary_role: { Args: { _user_id: string }; Returns: string } + acquire_ai_quota: { + Args: { _function_name: string; _model: string; _user_id: string } + Returns: Json + } + apply_transform: { + Args: { + p_transform_config?: Json + p_transform_type: string + p_value: string + } + Returns: string + } + audit_ownership_orphans: { + Args: { _triggered_by?: string } + Returns: string + } + audit_rls_coverage: { Args: never; Returns: Json } + audit_rls_matrix: { Args: never; Returns: Json } + audit_security_definer_acl: { + Args: never + Returns: { + arguments: string + function_name: string + granted_to: string + problem: string + }[] + } + auto_block_extreme_offenders: { Args: never; Returns: Json } + auto_revoke_orphan_full_keys: { + Args: { _source?: string } + Returns: { + created_by: string + key_id: string + revoked_at: string + }[] + } + block_ip_temp: { + Args: { _duration_minutes?: number; _ip: string; _reason: string } + Returns: string + } + build_full_scope_grants_v: { Args: never; Returns: undefined } + buscar_equivalencia_spot: { + Args: { p_spot_nome?: string; p_spot_sigla?: string } + Returns: { + confianca: string + spot_sigla: string + spot_tecnica_nome: string + tecnica_gravacao_nome: string + tecnica_variante_codigo: string + tecnica_variante_id: string + tecnica_variante_nome: string + }[] + } + calculate_personalization_price: { + Args: { + p_num_colors?: number + p_num_positions?: number + p_product_id: string + p_quantity: number + p_technique_id: string + } + Returns: { + base_price: number + color_cost: number + final_unit_price: number + position_cost: number + quantity_discount: number + total_price: number + }[] + } + calculate_quote_item_pricing: { + Args: { + p_organization_id: string + p_quantity: number + p_variant_id: string + } + Returns: { + cost_tier: number + margin_percent: number + price_tier: number + total_cost: number + total_price: number + total_profit: number + unit_cost: number + unit_price: number + }[] + } + calculate_seo_score: { + Args: { p_product_id: string } + Returns: { + issues: Json + score: number + }[] + } + can_access_quote: { Args: { _quote_id: string }; Returns: boolean } + can_approve_discount: { Args: { _user_id?: string }; Returns: boolean } + can_grant_mcp_full: { Args: { _user_id: string }; Returns: boolean } + can_grant_mcp_full_to_user: { + Args: { _target_user_id: string } + Returns: boolean + } + can_manage_connections: { Args: { _user_id?: string }; Returns: boolean } + can_manage_quotes: { Args: { _user_id?: string }; Returns: boolean } + can_view_all_sales: { Args: never; Returns: boolean } + can_view_audit_logs: { Args: { _user_id?: string }; Returns: boolean } + can_view_connections: { Args: { _user_id?: string }; Returns: boolean } + can_view_telemetry: { Args: { _user_id?: string }; Returns: boolean } + check_ai_quota: { Args: { _user_id: string }; Returns: Json } + check_auth_throttling: { + Args: { _email: string; _ip: string } + Returns: { + allowed: boolean + remaining_seconds: number + }[] + } + check_edge_rate_limit: { + Args: { p_key: string; p_max_requests: number; p_window_ms: number } + Returns: { + allowed: boolean + remaining: number + reset_at: string + }[] + } + check_geo_country_allowed: { + Args: { _country_code: string } + Returns: boolean + } + check_hardening_status: { Args: never; Returns: Json } + check_image_quality_report: { + Args: never + Returns: { + check_name: string + details: string + status: string + }[] + } + check_ip_access: { Args: { _ip: string }; Returns: string } + check_login_rate_limit: { + Args: { _email: string; _ip?: string } + Returns: Json + } + check_mcp_abuse_threshold: { + Args: { _ip: string; _user_id: string } + Returns: undefined + } + check_media_coverage: { + Args: never + Returns: { + check_name: string + details: string + status: string + }[] + } + check_owner_email: { Args: { _user_id: string }; Returns: string } + check_rate_limit: { + Args: { + _block_duration_seconds?: number + _endpoint: string + _identifier: string + _max_requests?: number + _window_seconds?: number + } + Returns: Json + } + check_telemetry_regression: { Args: never; Returns: Json } + check_video_health: { + Args: never + Returns: { + categoria: string + metrica: string + status: string + valor: string + }[] + } + claim_next_optimization: { + Args: never + Returns: { + category: string + created_at: string + created_by: string | null + description: string | null + error: string | null + finished_at: string | null + guardrail_status: string | null + id: string + priority: number + result: Json | null + started_at: string | null + status: string + title: string + updated_at: string + } + SetofOptions: { + from: "*" + to: "optimization_queue" + isOneToOne: true + isSetofReturn: false + } + } + classify_balde_gelo: { Args: { product_name: string }; Returns: Json } + classify_bolsa_termica: { Args: { product_name: string }; Returns: Json } + classify_bone: { Args: { product_name: string }; Returns: Json } + classify_bowl: { Args: { product_name: string }; Returns: Json } + classify_camiseta: { Args: { product_name: string }; Returns: Json } + classify_caneca: { Args: { product_name: string }; Returns: Json } + classify_chaveiro: { Args: { product_name: string }; Returns: Json } + classify_copo: { Args: { product_name: string }; Returns: Json } + classify_coqueteleira: { Args: { product_name: string }; Returns: Json } + classify_espelho: { Args: { product_name: string }; Returns: Json } + classify_fone_ouvido: { Args: { product_name: string }; Returns: Json } + classify_guarda_chuva: { Args: { product_name: string }; Returns: Json } + classify_headphone: { Args: { p_product_name: string }; Returns: Json } + classify_kit_banho: { Args: { product_name: string }; Returns: Json } + classify_kit_churrasco: { Args: { product_name: string }; Returns: Json } + classify_kit_executivo: { Args: { product_name: string }; Returns: Json } + classify_kit_ferramentas: { + Args: { product_name: string } + Returns: Json + } + classify_kit_queijo: { Args: { product_name: string }; Returns: Json } + classify_kit_vinho: { Args: { product_name: string }; Returns: Json } + classify_lanterna: { Args: { product_name: string }; Returns: Json } + classify_marmita: { Args: { product_name: string }; Returns: Json } + classify_massageador: { Args: { product_name: string }; Returns: Json } + classify_mochila: { Args: { product_name: string }; Returns: Json } + classify_necessaire: { Args: { product_name: string }; Returns: Json } + classify_oculos: { Args: { product_name: string }; Returns: Json } + classify_pasta: { Args: { product_name: string }; Returns: Json } + classify_pen: { Args: { product_name: string }; Returns: Json } + classify_pendrive: { Args: { p_product_name: string }; Returns: Json } + classify_petisqueira: { Args: { product_name: string }; Returns: Json } + classify_porta_caneta: { Args: { product_name: string }; Returns: Json } + classify_porta_copo: { Args: { product_name: string }; Returns: Json } + classify_porta_garrafa: { Args: { product_name: string }; Returns: Json } + classify_porta_retrato: { Args: { product_name: string }; Returns: Json } + classify_porta_whisky: { Args: { product_name: string }; Returns: Json } + classify_powerbank: { Args: { p_product_name: string }; Returns: Json } + classify_product_origin: { + Args: { p_product_id?: string; p_update_records?: boolean } + Returns: Json + } + classify_product_universal: { + Args: { product_name: string } + Returns: { + attributes: Json + category_id: string + category_level: number + category_name: string + category_path: string + category_slug: string + confidence: string + detected_material: string + detected_type: string + }[] + } + classify_regua: { Args: { product_name: string }; Returns: Json } + classify_relogio: { Args: { product_name: string }; Returns: Json } + classify_sacochila: { Args: { product_name: string }; Returns: Json } + classify_sacola: { Args: { product_name: string }; Returns: Json } + classify_speaker: { Args: { p_product_name: string }; Returns: Json } + classify_squeeze: { Args: { product_name: string }; Returns: Json } + classify_tabua: { Args: { product_name: string }; Returns: Json } + classify_taca: { Args: { product_name: string }; Returns: Json } + classify_tech_product: { Args: { p_product_name: string }; Returns: Json } + classify_tulipa: { Args: { product_name: string }; Returns: Json } + classify_umidificador: { Args: { product_name: string }; Returns: Json } + classify_xbz_category: + | { + Args: { p_product_name: string } + Returns: { + category_id: string + category_level: number + category_name: string + category_slug: string + confidence: string + }[] + } + | { Args: { p_raw_data: Json }; Returns: string } + classify_xicara: { Args: { product_name: string }; Returns: Json } + clean_old_audit_logs: { Args: { _days?: number }; Returns: number } + clean_old_rate_limits: { Args: never; Returns: number } + cleanup_discount_test_data: { Args: never; Returns: Json } + cleanup_expired_collection_trash: { Args: never; Returns: number } + cleanup_expired_edge_rate_limits: { Args: never; Returns: undefined } + cleanup_expired_favorite_trash: { Args: never; Returns: number } + cleanup_expired_novelties: { Args: never; Returns: number } + cleanup_expired_public_comparisons: { Args: never; Returns: number } + cleanup_expired_step_up: { Args: never; Returns: undefined } + cleanup_expired_step_up_tokens: { Args: never; Returns: number } + cleanup_expired_webhook_request_nonces: { Args: never; Returns: number } + cleanup_old_login_attempts: { Args: never; Returns: number } + cleanup_old_logs: { Args: { p_days_to_keep?: number }; Returns: number } + cleanup_old_notifications: { Args: never; Returns: undefined } + cleanup_orphan_step_up_artifacts: { Args: never; Returns: number } + cleanup_rate_limits: { Args: never; Returns: undefined } + cleanup_security_logs: { Args: never; Returns: Json } + cleanup_webhook_logs: { Args: never; Returns: Json } + clear_auth_attempts: { Args: { _email: string }; Returns: undefined } + clear_user_token_revocations: { + Args: { _user_id: string } + Returns: undefined + } + cm_to_mm: { Args: { p_cm: number }; Returns: number } + comparar_precos_spot: { + Args: { p_dados_api: Json } + Returns: { + out_area_descricao: string + out_faixa_preco: string + out_margem_anterior_pct: number + out_margem_nova_pct: number + out_margem_variacao_pp: number + out_nivel_alerta: string + out_nosso_preco: number + out_spot_anterior: number + out_spot_novo: number + out_spot_variacao_pct: number + out_table_code: string + out_table_code_option: string + out_tecnica_nome: string + out_tipo_mudanca: string + }[] + } + compare_product_ai_versions: { + Args: { p_product_id: string; p_version_a: number; p_version_b: number } + Returns: { + campo: string + versao_a: string + versao_b: string + }[] + } + compare_quote_snapshots: { + Args: { _quote_id: string; _version_a: number; _version_b: number } + Returns: Json + } + compare_quote_versions: { + Args: { _quote_id: string; _version_a: number; _version_b: number } + Returns: Json + } + complete_optimization: { + Args: { + _error?: string + _guardrail_status?: string + _id: string + _notes?: string + _result?: Json + _status: string + } + Returns: { + category: string + created_at: string + created_by: string | null + description: string | null + error: string | null + finished_at: string | null + guardrail_status: string | null + id: string + priority: number + result: Json | null + started_at: string | null + status: string + title: string + updated_at: string + } + SetofOptions: { + from: "*" + to: "optimization_queue" + isOneToOne: true + isSetofReturn: false + } + } + complete_xbz_image_import: { + Args: { + p_cloudflare_id: string + p_product_id?: string + p_staging_id: string + p_variant_id?: string + } + Returns: string + } + compute_quote_snapshot_hash: { + Args: { _quote_id: string } + Returns: string + } + consolidate_variant_stock: { + Args: { p_variant_id: string } + Returns: { + new_stock: number + previous_stock: number + supplier_count: number + suppliers_detail: Json + variant_id: string + }[] + } + consume_step_up_token: { + Args: { + _expected_action: Database["public"]["Enums"]["step_up_action"] + _expected_target?: string + _token: string + } + Returns: boolean + } + convert_quote_to_order: { + Args: { + p_organization_id?: string + p_quote_id: string + p_seller_id: string + } + Returns: Json + } + convert_string_to_unit: { + Args: { p_input: string; p_target_unit: string } + Returns: number + } + create_material_with_equivalence: { + Args: { + p_force_type_slug?: string + p_material_group?: string + p_material_key: string + p_material_name: string + p_supplier_id: string + } + Returns: Json + } + create_materials_batch: { + Args: { p_materials: Json; p_supplier_id: string } + Returns: Json + } + create_organization_with_owner: { + Args: { _name: string; _slug: string } + Returns: string + } + cron_invoke_edge: { + Args: { + p_body?: Json + p_timeout_ms?: number + p_url_secret_name: string + } + Returns: number + } + current_user_role: { Args: never; Returns: string } + debug_automations: { + Args: { p_product_id: string } + Returns: { + check_name: string + check_result: string + }[] + } + debug_image_type: { + Args: { p_filename: string; p_supplier_code?: string } + Returns: { + detected_suffix: string + filename: string + mapped_type: string + supplier_code: string + type_category: string + }[] + } + debug_link_material: { + Args: { p_product_id: string; p_supplier_id?: string } + Returns: { + result: string + step: string + }[] + } + detect_geo_violations: { Args: { _days?: number }; Returns: Json } + disable_classify_function: { + Args: { p_function_name: string } + Returns: Json + } + e2e_cleanup_check_rate_limit: { + Args: { p_key: string; p_max: number; p_window_seconds: number } + Returns: { + allowed: boolean + current_count: number + reset_in_seconds: number + }[] + } + enable_classify_function: { + Args: { p_function_name: string } + Returns: Json + } + enable_step_up_for_user: { + Args: { _user_id: string } + Returns: undefined + } + enqueue_optimization: { + Args: { + _category?: string + _description?: string + _priority?: number + _title: string + } + Returns: string + } + ensure_default_favorite_list: { + Args: { _user_id: string } + Returns: string + } + execute_role_migration_batch: { + Args: { + _dry_run?: boolean + _items: Json + _label: string + _reason: string + } + Returns: string + } + expert_chat_create_conversation: { + Args: { _client_id?: string; _title?: string } + Returns: string + } + expert_chat_get_conversation: { + Args: { _conv_id: string } + Returns: Json + } + expert_chat_get_messages: { + Args: { _conv_id: string; _limit?: number } + Returns: Json + } + expert_chat_log_event: { + Args: { + _content?: string + _conv_id: string + _event_type: string + _media_url?: string + _role: string + _tokens?: number + } + Returns: string + } + expert_chat_send_message: { + Args: { _content: string; _conv_id: string; _role: string } + Returns: string + } + expert_chat_update_status: { + Args: { _session_id: string; _status: string } + Returns: undefined + } + expire_stale_password_reset_requests: { Args: never; Returns: number } + extract_capacity_ml: { Args: { p_name: string }; Returns: number } + extract_json_value: { + Args: { p_data: Json; p_path: string } + Returns: string + } + extract_keywords: { + Args: { input_text: string; max_keywords?: number } + Returns: string[] + } + extract_product_material: { + Args: { product_description?: string; product_name: string } + Returns: Json + } + extract_xbz_color_code: { + Args: { p_codigo_composto: string } + Returns: string + } + extract_xbz_image_metadata: { Args: { p_url: string }; Returns: Json } + extract_xbz_material: { + Args: { p_descricao?: string; p_nome: string } + Returns: { + confidence: string + material_group: string + material_name: string + }[] + } + extract_xbz_material_group: { + Args: { p_descricao?: string; p_nome: string } + Returns: string + } + extract_xbz_material_primary: { + Args: { p_descricao?: string; p_nome: string } + Returns: string + } + extract_xbz_materials_array: { + Args: { p_descricao?: string; p_nome: string } + Returns: string[] + } + extract_xbz_product_code: { + Args: { p_codigo_composto: string } + Returns: string + } + extract_youtube_id: { Args: { p_url: string }; Returns: string } + fn_add_packaging_compatibility: { + Args: { + p_packaging_id: string + p_product_id: string + p_recommended?: boolean + p_source?: string + } + Returns: Json + } + fn_add_supplier_mapping: { + Args: { + p_notes?: string + p_priority?: number + p_property_code: string + p_raw_pattern: string + p_supplier_code: string + } + Returns: Json + } + fn_adicionar_mapeamento_fornecedor: { + Args: { + p_nome_fornecedor: string + p_observacao?: string + p_regra_formato?: string + p_supplier_id: string + p_table_code?: string + p_tecnica_variante_codigo: string + } + Returns: string + } + fn_aggregate_stock_daily: { Args: { p_date?: string }; Returns: Json } + fn_apply_asia_properties_to_product: { + Args: { + p_api_altura?: number + p_api_comprimento?: number + p_api_largura?: number + p_api_peso?: number + p_origem_faturamento?: string + p_propriedades: Json + p_sku: string + } + Returns: Json + } + fn_apply_transform: + | { + Args: { + p_source_unit: string + p_supplier_id: string + p_target_unit: string + p_transform_config: Json + p_transform_type: string + p_value: string + } + Returns: string + } + | { + Args: { + p_supplier_id?: string + p_transform_config?: Json + p_transform_type: string + p_value: string + } + Returns: string + } + fn_auto_discover_compatible_packagings: { + Args: { p_min_fit_rating?: string; p_product_id: string } + Returns: Json + } + fn_auto_link_commemorative_dates: { + Args: { p_product_id: string } + Returns: number + } + fn_auto_link_eco: { Args: { p_product_id: string }; Returns: boolean } + fn_auto_link_feminino: { + Args: { p_product_id: string } + Returns: boolean + } + fn_auto_link_product_to_color_categories: { + Args: { p_color_id: string; p_product_id: string } + Returns: Json + } + fn_auto_link_properties: { + Args: { p_product_id: string; p_supplier_id?: string } + Returns: number + } + fn_auto_link_tags: { + Args: { p_product_id: string; p_supplier_id?: string } + Returns: number + } + fn_backfill_eco_links: { + Args: never + Returns: { + links_categoria_criados: number + links_data_criados: number + produtos_processados: number + }[] + } + fn_backfill_feminine_links: { + Args: never + Returns: { + links_dia_maes_criados: number + links_dia_mulher_criados: number + produtos_atualizados: number + variantes_processadas: number + }[] + } + fn_backfill_product_attributes_safe: { + Args: { p_batch_size?: number; p_dry_run?: boolean } + Returns: Json + } + fn_backfill_product_categories: { + Args: { p_batch_size?: number; p_dry_run?: boolean } + Returns: Json + } + fn_batch_extract_materials_from_name: { + Args: { p_limit?: number } + Returns: { + processed: number + total_materials: number + }[] + } + fn_batch_populate_packing: { + Args: { p_limit?: number } + Returns: { + commercial: number + processed: number + protective: number + updated: number + }[] + } + fn_best_packaging_price: { + Args: { p_packaging_id: string; p_quantity?: number } + Returns: { + lead_time_days: number + supplier_id: string + supplier_name: string + total_price: number + unit_price: number + }[] + } + fn_calculate_health_score: { + Args: never + Returns: { + calculated_at: string + grade: string + pontos_atencao: Json + pontos_positivos: Json + score: number + }[] + } + fn_calculate_kit_dimensions: { + Args: { p_kit_id: string } + Returns: { + materials_list: string[] + packaging_height_mm: number + packaging_length_mm: number + packaging_type: string + packaging_width_mm: number + total_components: number + total_pieces: number + total_weight_g: number + }[] + } + fn_calculate_packaging_fit: { + Args: { p_packaging_id: string; p_product_id: string } + Returns: Json + } + fn_calculate_sale_price: { + Args: { + p_price_list_id?: string + p_product_id: string + p_quantity?: number + } + Returns: number + } + fn_capacity_forecast: { + Args: { p_days_ahead?: number } + Returns: { + current_value: number + growth_per_day: number + metric: string + projected_value: number + projection_date: string + status: string + }[] + } + fn_check_geo_access: { + Args: { p_country_code: string } + Returns: boolean + } + fn_check_item_fits: { + Args: { + p_current_used_liters?: number + p_packaging_id: string + p_product_id: string + } + Returns: { + available_volume: number + fits: boolean + packaging_volume: number + percentage_used: number + product_volume: number + used_volume: number + }[] + } + fn_claim_ai_description_batch: { + Args: { p_batch_size?: number } + Returns: { + category_path: string + color_names: string[] + material_names: string[] + product_description: string + product_id: string + product_name: string + product_sku: string + queue_id: string + }[] + } + fn_classify_packing_type: { + Args: { p_packing_type: string } + Returns: Json + } + fn_classify_spot_image: { + Args: { p_filename: string } + Returns: { + color_code: string + display_order_hint: number + image_type: string + image_type_id: string + is_color_specific: boolean + is_primary_image: boolean + prod_reference: string + }[] + } + fn_classify_spot_image_v3: { + Args: { p_filename: string; p_main_image?: string } + Returns: { + color_code: string + display_order: number + image_type: string + image_type_id: string + is_color_specific: boolean + is_primary: boolean + spot_ref: string + }[] + } + fn_complete_ai_description: { + Args: { + p_ai_description?: string + p_ai_model?: string + p_ai_summary?: string + p_ai_title?: string + p_error_message?: string + p_queue_id: string + p_success: boolean + } + Returns: boolean + } + fn_compute_and_record_drift: { + Args: { p_lovable_signatures: Json } + Returns: string + } + fn_convert_box_dimension_to_cm: { + Args: { p_value: string } + Returns: number + } + fn_convert_unit: { + Args: { + p_source_unit: string + p_supplier_id?: string + p_target_unit: string + p_value: number + } + Returns: number + } + fn_count_products_by_packing: { + Args: never + Returns: { + packing_type: string + percentage: number + total: number + }[] + } + fn_create_import_batch: { + Args: { p_notes?: string; p_supplier_id: string } + Returns: string + } + fn_create_multiple_equivalences: { + Args: { p_organization_id?: string; p_supplier_material_id: string } + Returns: { + created: boolean + material_part: string + promo_type_id: string + promo_type_name: string + status: string + }[] + } + fn_create_quote_v3: { + Args: { p_items_data: Json; p_quote_data: Json } + Returns: Json + } + fn_deploy_readiness_check: { + Args: never + Returns: { + check_name: string + check_status: string + details: string + recommendation: string + severity: string + }[] + } + fn_detecta_familia_cor: { + Args: { p_b: number; p_g: number; p_r: number } + Returns: string + } + fn_distribute_percentage: { + Args: { p_count?: number; p_total?: number } + Returns: number[] + } + fn_enqueue_products_for_ai_description: { + Args: { p_limit?: number; p_only_active?: boolean; p_priority?: number } + Returns: { + already_queued: number + enqueued: number + skipped: number + }[] + } + fn_expire_novelties_with_stats: { Args: never; Returns: Json } + fn_expire_product_novelties: { Args: never; Returns: number } + fn_extract_asia_variants: { + Args: { p_supplier_id?: string } + Returns: Json + } + fn_extract_capacity_from_name: { + Args: { p_name: string } + Returns: number + } + fn_extract_color_from_name: { + Args: { p_name: string } + Returns: string[] + } + fn_extract_dimensions_from_name: { + Args: { p_name: string } + Returns: Json + } + fn_extract_keywords_from_name: { + Args: { p_name: string } + Returns: string[] + } + fn_extract_material_from_name: { + Args: { p_name: string } + Returns: string[] + } + fn_extract_materials_from_name: { + Args: { p_product_id: string; p_replace_existing?: boolean } + Returns: number + } + fn_extract_numeric: { Args: { p_value: string }; Returns: number } + fn_extract_optional_packaging_ref: { + Args: { p_description: string } + Returns: string + } + fn_extract_packaging_from_description: { + Args: { p_description: string } + Returns: Json + } + fn_extract_properties_by_supplier: { + Args: { p_raw_properties: string; p_supplier_code?: string } + Returns: { + matched_pattern: string + property_code: string + property_value: string + raw_value: string + }[] + } + fn_extract_properties_from_api: { + Args: { p_raw_properties: string; p_supplier_code?: string } + Returns: { + property_code: string + property_value: string + raw_value: string + }[] + } + fn_extract_weight_from_name: { Args: { p_name: string }; Returns: number } + fn_find_compatible_packagings: { + Args: { p_limit?: number; p_product_id: string } + Returns: { + fit_rating: string + gap_min_mm: number + name: string + packaging_id: string + price: number + recommended: boolean + same_supplier: boolean + sku: string + }[] + } + fn_find_material_type_id: { + Args: { material_name: string } + Returns: string + } + fn_finish_import_batch: { Args: { p_batch_id: string }; Returns: Json } + fn_format_capacity_display: { + Args: { p_capacity_ml: number } + Returns: string + } + fn_format_dimensions_display: { + Args: { p_height_cm?: number; p_length_cm: number; p_width_cm: number } + Returns: string + } + fn_get_customization_price: { + Args: { + p_altura_cm?: number + p_area_id: string + p_largura_cm?: number + p_num_cores?: number + p_num_pontos?: number + p_quantidade: number + } + Returns: Json + } + fn_get_ncm_id: { Args: { raw_ncm: string }; Returns: string } + fn_get_price_by_quantity: { + Args: { + p_price_list_id?: string + p_quantity?: number + p_variant_id: string + } + Returns: Json + } + fn_get_product_accessories: { + Args: { p_product_id: string } + Returns: { + accessory_category_id: string + accessory_category_name: string + display_label: string + is_required: boolean + relationship_type: string + }[] + } + fn_get_product_customization_options: { + Args: { p_product_id: string } + Returns: Json + } + fn_get_product_dates: { + Args: { p_product_id: string } + Returns: { + date_day: number + date_id: string + date_month: number + date_name: string + is_featured: boolean + source: string + target_audience: string + }[] + } + fn_get_product_packaging_summary: { + Args: { p_product_id: string } + Returns: Json + } + fn_get_product_properties: { + Args: { p_product_id: string } + Returns: { + icon_code: string + is_thermal: boolean + property_category: string + property_code: string + property_name: string + property_value: string + }[] + } + fn_get_products_with_gift_box: { + Args: { + p_category_id?: string + p_limit?: number + p_offset?: number + p_supplier_id?: string + } + Returns: { + category_id: string + id: string + image_url: string + name: string + packing_classification: string + packing_type: string + sale_price: number + sku: string + supplier_id: string + }[] + } + fn_get_supplier_mappings: { + Args: { p_supplier_code: string } + Returns: { category: string - created_at: string id: string - is_read: boolean - message: string - metadata: Json | null - title: string - type: string - user_id: string + is_thermal: boolean + priority: number + property_code: string + property_name: string + raw_pattern: string + }[] + } + fn_health_check_gravacao: { + Args: never + Returns: { + categoria: string + detalhe: string + metrica: string + status: string + valor: string + }[] + } + fn_import_product_properties: { + Args: { + p_product_id: string + p_raw_properties: string + p_source?: string + p_supplier_code?: string } - Insert: { - action_url?: string | null - category?: string - created_at?: string - id?: string - is_read?: boolean - message: string - metadata?: Json | null - title: string - type?: string - user_id: string + Returns: Json + } + fn_import_spot_image: { + Args: { + p_cloudflare_id: string + p_file_size?: number + p_filename: string + p_height?: number + p_url_original: string + p_width?: number } - Update: { - action_url?: string | null - category?: string - created_at?: string - id?: string - is_read?: boolean - message?: string - metadata?: Json | null - title?: string - type?: string - user_id?: string + Returns: string + } + fn_import_stock_from_spot: { + Args: { p_stocks: Json } + Returns: { + details: Json + total_created: number + total_errors: number + total_processed: number + total_skipped: number + total_updated: number + }[] + } + fn_import_xbz_image: { + Args: { + p_cloudflare_id: string + p_file_size?: number + p_filename?: string + p_height?: number + p_product_id: string + p_url_original: string + p_width?: number } - Relationships: [] + Returns: string } - } - Views: { - v_full_scope_grants: { - Row: { - audit_id: string | null - challenge_id: string | null - extra: Json | null - granted_at: string | null - granted_to_email: string | null - granted_to_name: string | null - granted_to_user_id: string | null - ip_address: unknown - justification: string | null - key_expires_at: string | null - key_id: string | null - key_prefix: string | null - operation: string | null - request_id: string | null - step_up_action: Database["public"]["Enums"]["step_up_action"] | null - token_id: string | null - user_agent: string | null - verifications_applied: Json | null + fn_index_usage_report: { + Args: never + Returns: { + indice: string + recomendacao: string + scans: number + tabela: string + tamanho: string + tipo: string + }[] + } + fn_is_admin_user: { Args: { p_user_id?: string }; Returns: boolean } + fn_is_thermal_product: { + Args: { p_product_id: string } + Returns: boolean + } + fn_link_product_materials: { + Args: { p_product_id: string; p_supplier_id?: string } + Returns: number + } + fn_map_value: { + Args: { + p_field_type: string + p_source_value: string + p_supplier_id: string } - Relationships: [] + Returns: string } - } - Functions: { - _can_act_on_behalf_of_others: { Args: never; Returns: boolean } - acquire_ai_quota: { - Args: { _function_name: string; _model: string; _user_id: string } + fn_mapear_oficial_para_staging: { + Args: { p_codigo_oficial: string } + Returns: string + } + fn_mark_removed_from_spot: { + Args: { p_current_skus: string[] } + Returns: { + marked_as_removed: number + }[] + } + fn_master_classify_product: { + Args: { p_name: string; p_product_id?: string } Returns: Json } - audit_ownership_orphans: { - Args: { _triggered_by?: string } - Returns: string + fn_normalize_ncm: { Args: { raw_ncm: string }; Returns: string } + fn_normalize_product_dimensions: { + Args: { + p_dry_run?: boolean + p_product_id?: string + p_supplier_id?: string + } + Returns: Json } - audit_rls_coverage: { Args: never; Returns: Json } - audit_rls_matrix: { Args: never; Returns: Json } - audit_security_definer_acl: { - Args: never + fn_parse_asia_properties: { + Args: { + p_api_altura?: number + p_api_comprimento?: number + p_api_largura?: number + p_api_peso?: number + p_origem_faturamento?: string + p_propriedades: Json + } + Returns: Json + } + fn_parse_capacity_ml: { Args: { p_capacity: string }; Returns: number } + fn_parse_composite_material: { + Args: { material_string: string } Returns: { - arguments: string - function_name: string - granted_to: string - problem: string + material_part: string + sort_order: number }[] } - auto_block_extreme_offenders: { Args: never; Returns: Json } - auto_revoke_orphan_full_keys: { - Args: { _source?: string } + fn_parse_product_dimensions: { + Args: { p_dimensions_text: string } + Returns: Json + } + fn_parse_product_weight: { + Args: { + p_box_quantity?: number + p_box_weight_kg?: number + p_product_name?: string + p_weight: number + p_weight_unit?: string + } + Returns: Json + } + fn_pipeline_complete_step: { + Args: { p_etapa: number; p_resultado?: Json } + Returns: undefined + } + fn_pipeline_error_step: { + Args: { p_error: string; p_etapa: number } + Returns: undefined + } + fn_pipeline_start_step: { Args: { p_etapa: number }; Returns: undefined } + fn_pipeline_status: { + Args: never Returns: { - created_by: string - key_id: string - revoked_at: string + com_erro: number + concluidas: number + em_andamento: number + pct_completo: number + pendentes: number + proxima_etapa: number + proxima_titulo: string + total_etapas: number }[] } - can_approve_discount: { Args: { _user_id?: string }; Returns: boolean } - can_grant_mcp_full: { Args: { _user_id: string }; Returns: boolean } - can_manage_connections: { Args: { _user_id?: string }; Returns: boolean } - can_manage_quotes: { Args: { _user_id?: string }; Returns: boolean } - can_view_all_sales: { Args: { _user_id?: string }; Returns: boolean } - can_view_audit_logs: { Args: { _user_id?: string }; Returns: boolean } - can_view_connections: { Args: { _user_id?: string }; Returns: boolean } - can_view_telemetry: { Args: { _user_id?: string }; Returns: boolean } - check_ai_quota: { Args: { _user_id: string }; Returns: Json } - check_auth_throttling: { - Args: { _email: string; _ip: string } + fn_populate_all_products_seo: { Args: never; Returns: Json } + fn_populate_novelties_from_supplier: { Args: never; Returns: Json } + fn_process_all_composite_materials: { + Args: { p_organization_id?: string } Returns: { - allowed: boolean - remaining_seconds: number + api_material_name: string + equivalences_created: number + equivalences_existing: number + parts_found: number + parts_not_matched: number + supplier_material_id: string }[] } - check_edge_rate_limit: { - Args: { p_key: string; p_max_requests: number; p_window_ms: number } + fn_process_all_products_materials: { + Args: { + p_limit?: number + p_organization_id?: string + p_replace_existing?: boolean + } Returns: { - allowed: boolean - remaining: number - reset_at: string + materials_array: string + materials_found: number + materials_missing: number + materials_processed: number + product_id: string + product_name: string }[] } - check_hardening_status: { Args: never; Returns: Json } - check_ip_access: { Args: { _ip: string }; Returns: string } - check_mcp_abuse_threshold: { - Args: { _ip: string; _user_id: string } - Returns: undefined + fn_process_all_staged_products: { + Args: { p_limit?: number; p_supplier_id?: string } + Returns: Json } - check_rate_limit: { + fn_process_all_staged_variants: { + Args: { p_limit?: number; p_supplier_id?: string } + Returns: Json + } + fn_process_composite_materials: { Args: { - _block_duration_seconds?: number - _endpoint: string - _identifier: string - _max_requests?: number - _window_seconds?: number + p_materials_string: string + p_organization_id?: string + p_product_id: string + p_replace_existing?: boolean } + Returns: { + material_name: string + material_type_id: string + status: string + }[] + } + fn_process_product_materials_auto: { + Args: { p_product_id: string; p_replace_existing?: boolean } + Returns: { + material_name: string + material_type_id: string + status: string + }[] + } + fn_process_staged_product: { + Args: { p_staging_id: string } Returns: Json } - check_telemetry_regression: { Args: never; Returns: Json } - claim_next_optimization: { + fn_process_staged_variant: { + Args: { p_staging_id: string } + Returns: Json + } + fn_process_staging_batch: { + Args: { p_batch_id?: string; p_supplier_id?: string } + Returns: Json + } + fn_product_has_packaging: { + Args: { p_product_id: string } + Returns: Json + } + fn_product_market_intelligence: { + Args: { p_days?: number; p_product_id: string } + Returns: Json + } + fn_propagate_category_min_quantity: { + Args: { p_category_id: string; p_new_min_quantity: number } + Returns: { + updated_products: number + }[] + } + fn_recalculate_all_sale_prices: { + Args: { p_batch_size?: number } + Returns: { + errors: number + message: string + processed: number + updated: number + }[] + } + fn_recalculate_all_stock: { Args: never Returns: { - category: string - created_at: string - created_by: string | null - description: string | null - error: string | null - finished_at: string | null - guardrail_status: string | null - id: string - priority: number - result: Json | null - started_at: string | null - status: string - title: string - updated_at: string - } - SetofOptions: { - from: "*" - to: "optimization_queue" - isOneToOne: true - isSetofReturn: false + products_updated: number + variants_updated: number + }[] + } + fn_recomendar_tecnica: { + Args: { + p_categoria?: string + p_complexidade_arte?: string + p_material?: string + p_n_cores?: number + p_qty?: number } + Returns: { + alerta: string + codigo_tabela: string + grupo_tecnica: string + motivo: string + nome: string + rank: number + }[] + } + fn_refresh_media_health: { Args: never; Returns: undefined } + fn_relatorio_cores_pendentes: { + Args: never + Returns: { + codigo: string + nome: string + quantidade: number + tipo: string + }[] + } + fn_remove_orphan_color_links: { + Args: { p_old_color_id: string; p_product_id: string } + Returns: Json + } + fn_reprocessar_variantes_sem_cor: { + Args: never + Returns: { + variantes_pendentes: number + variantes_processadas: number + variantes_vinculadas: number + }[] + } + fn_resync_categories_products_count: { + Args: never + Returns: { + categorias_corrigidas: number + total_categorias: number + }[] + } + fn_run_schema_drift_check: { Args: never; Returns: Json } + fn_run_smoke_tests: { + Args: never + Returns: { + details: string + duration_ms: number + result: string + test_category: string + test_name: string + }[] + } + fn_save_quote_draft: { Args: { p_data: Json }; Returns: string } + fn_set_category_min_quantity: { + Args: { p_category_slug: string; p_min_quantity: number } + Returns: { + category_id: string + category_name: string + new_min: number + old_min: number + products_affected: number + }[] + } + fn_simular_combo_gravacao: { + Args: { aplicacoes: Json } + Returns: { + app_ordem: number + arte: string + cores: string + custo_final: number + custo_natural: number + location_code: string + motivo_erro: string + piso_comercial_aplicado: number + product_id: string + qty: number + regra_ativada: string + tecnica_codigo: string + venda_aplicacao: number + }[] + } + fn_simular_combo_gravacao_kit_v1: { + Args: { aplicacoes: Json } + Returns: { + altura_cm: number + app_ordem: number + arte: string + componente_nome: string + cores: string + custo_final: number + custo_natural: number + kit_component_id: string + kit_product_id: string + largura_cm: number + location_code: string + motivo_erro: string + piso_setup: number + preco_unit_efetivo: number + preco_unit_faixa: number + qty: number + regra_ativada: string + tabela_codigo: string + tecnica_codigo: string + }[] + } + fn_simular_combo_gravacao_v10: { + Args: { aplicacoes: Json } + Returns: { + app_ordem: number + arte: string + cores: string + custo_final: number + custo_natural: number + location_code: string + piso_comercial_aplicado: number + product_id: string + qty: number + regra_ativada: string + tecnica_codigo: string + venda_aplicacao: number + }[] + } + fn_simular_combo_gravacao_v11: { + Args: { aplicacoes: Json } + Returns: { + app_ordem: number + arte: string + cores: string + custo_final: number + custo_natural: number + location_code: string + motivo_erro: string + piso_comercial_aplicado: number + product_id: string + qty: number + regra_ativada: string + tecnica_codigo: string + venda_aplicacao: number + }[] + } + fn_simular_combo_gravacao_v12: { + Args: { aplicacoes: Json } + Returns: { + app_ordem: number + arte: string + cores: string + custo_final: number + custo_natural: number + location_code: string + motivo_erro: string + piso_comercial_aplicado: number + product_id: string + qty: number + regra_ativada: string + tecnica_codigo: string + venda_aplicacao: number + }[] + } + fn_simular_combo_gravacao_v8_legacy: { + Args: { aplicacoes: Json } + Returns: { + app_ordem: number + arte: string + cores: string + custo_final: number + custo_natural: number + piso_comercial_aplicado: number + qty: number + regra_ativada: string + tecnica_codigo: string + venda_aplicacao: number + }[] + } + fn_simular_combo_gravacao_v9_legacy_2026_04: { + Args: { aplicacoes: Json } + Returns: { + app_ordem: number + arte: string + cores: string + custo_final: number + custo_natural: number + location_code: string + piso_comercial_aplicado: number + product_id: string + qty: number + regra_ativada: string + tecnica_codigo: string + venda_aplicacao: number + }[] } - cleanup_discount_test_data: { Args: never; Returns: Json } - cleanup_expired_collection_trash: { Args: never; Returns: number } - cleanup_expired_edge_rate_limits: { Args: never; Returns: undefined } - cleanup_expired_favorite_trash: { Args: never; Returns: number } - cleanup_expired_public_comparisons: { Args: never; Returns: number } - cleanup_expired_step_up: { Args: never; Returns: undefined } - cleanup_inbound_webhook_events: { Args: never; Returns: Json } - cleanup_old_notifications: { Args: never; Returns: undefined } - cleanup_rate_limits: { Args: never; Returns: undefined } - cleanup_security_logs: { Args: never; Returns: Json } - cleanup_simulation_telemetry: { Args: never; Returns: Json } - cleanup_webhook_logs: { Args: never; Returns: Json } - clear_auth_attempts: { Args: { _email: string }; Returns: undefined } - complete_optimization: { - Args: { - _error?: string - _guardrail_status?: string - _id: string - _notes?: string - _result?: Json - _status: string - } + fn_split_materials: { + Args: { p_materials_string: string } Returns: { - category: string - created_at: string - created_by: string | null - description: string | null - error: string | null - finished_at: string | null - guardrail_status: string | null - id: string - priority: number - result: Json | null - started_at: string | null - status: string - title: string - updated_at: string - } - SetofOptions: { - from: "*" - to: "optimization_queue" - isOneToOne: true - isSetofReturn: false - } + material_part: string + sort_order: number + }[] } - consume_step_up_token: - | { - Args: { _challenge_id: string; _token_hash: string } - Returns: boolean - } - | { - Args: { - _expected_action: Database["public"]["Enums"]["step_up_action"] - _expected_target?: string - _token: string - } - Returns: boolean - } - convert_quote_to_order: { + fn_stage_product: { Args: { - p_organization_id?: string - p_quote_id: string - p_seller_id: string + p_batch_id: string + p_raw_data: Json + p_supplier_id: string + p_supplier_reference: string } - Returns: Json - } - create_organization_with_owner: { - Args: { _name: string; _slug: string } Returns: string } - cron_invoke_edge: { + fn_stage_variant: { Args: { - p_body?: Json - p_timeout_ms?: number - p_url_secret_name: string + p_batch_id: string + p_raw_data: Json + p_supplier_id: string + p_supplier_reference: string + p_supplier_sku: string } + Returns: string + } + fn_sync_all_is_new: { Args: never; Returns: Json } + fn_sync_all_product_colors: { + Args: never + Returns: { + products_with_colors: number + products_without_colors: number + total_products: number + }[] + } + fn_sync_product_colors_from_variants: { + Args: { p_product_id: string } + Returns: undefined + } + fn_sync_single_product_dimensions: { + Args: { p_product_id: string; p_raw_data: Json } + Returns: boolean + } + fn_trigger_schema_drift_fetch: { Args: never; Returns: number } + fn_update_all_seo_scores: { Args: never; Returns: Json } + fn_update_product_dimensions: { Args: never; Returns: Json } + fn_validate_print_area_dimensions: { + Args: { p_altura?: number; p_area_id: string; p_largura?: number } + Returns: Json + } + fn_video_link_to_products: { + Args: { p_queue_id: string } Returns: number } - e2e_cleanup_check_rate_limit: { - Args: { p_key: string; p_max: number; p_window_seconds: number } + fn_video_queue_next: { + Args: { p_supplier?: string } Returns: { - allowed: boolean - current_count: number - reset_in_seconds: number + product_references: string[] + queue_id: string + retry_count: number + youtube_id: string + youtube_url: string }[] } - enqueue_optimization: { + fn_video_queue_stats: { + Args: { p_supplier?: string } + Returns: { + done: number + downloading: number + error_count: number + linked: number + pending: number + products_linked: number + total: number + uploading: number + }[] + } + fn_video_queue_update: { Args: { - _category?: string - _description?: string - _priority?: number - _title: string + p_cloudflare_duration?: number + p_cloudflare_embed?: string + p_cloudflare_hls?: string + p_cloudflare_thumbnail?: string + p_cloudflare_video_id?: string + p_error?: string + p_file_size?: number + p_queue_id: string + p_status: string + } + Returns: undefined + } + force_logout_all_users: { Args: never; Returns: number } + force_user_logout: { Args: { _user_id: string }; Returns: undefined } + g_to_kg: { Args: { p_g: number }; Returns: number } + generate_image_alt_text: { + Args: { + p_color_name?: string + p_display_order?: number + p_image_type?: string + p_product_name: string } Returns: string } - ensure_default_favorite_list: { - Args: { _user_id: string } + generate_mockup_approval_token: { Args: never; Returns: string } + generate_product_jsonld: { + Args: { p_base_url?: string; p_product_id: string } + Returns: Json + } + generate_product_meta_description: { + Args: { + p_allows_personalization?: boolean + p_description?: string + p_name: string + p_short_description?: string + } Returns: string } - execute_role_migration_batch: { + generate_product_meta_title: { + Args: { p_category_name?: string; p_name: string } + Returns: string + } + generate_product_slug: { + Args: { p_name: string; p_product_id?: string } + Returns: string + } + generate_promo_sku: { + Args: { p_reference: string; p_supplier_code: string } + Returns: string + } + generate_slug: { Args: { p_name: string }; Returns: string } + generate_step_up_challenge: { Args: { - _dry_run?: boolean - _items: Json - _label: string - _reason: string + _action: Database["public"]["Enums"]["step_up_action"] + _target_ref?: string } Returns: string } - fn_check_geo_access: { - Args: { p_country_code: string } - Returns: boolean + generate_variant_sku: { + Args: { p_product_code: string; p_supplier_color_id: string } + Returns: string } - fn_create_quote_v3: { - Args: { p_items_data: Json; p_quote_data: Json } + generate_variant_sku_by_color_code: { + Args: { + p_color_code: string + p_product_code: string + p_supplier_id: string + } + Returns: string + } + gerar_resumo_alertas_bitrix: { + Args: { p_data_inicio?: string } Returns: Json } - fn_save_quote_draft: { Args: { p_data: Json }; Returns: string } + get_abc_curve: { + Args: { p_limit?: number; p_metric?: string } + Returns: { + abc_class: string + cumulative_percentage: number + metric_value: number + name: string + percentage: number + product_id: string + rank_position: number + sku: string + stock_quantity: number + stock_value: number + }[] + } + get_active_commemorative_dates: { + Args: never + Returns: { + campaign_start_days: number + category: string + color_count: number + color_hex: string + date_day: number + date_month: number + days_until: number + formatted_date: string + icon_name: string + id: string + is_featured: boolean + name: string + product_count: number + slug: string + }[] + } + get_active_novelties: { + Args: { + p_limit?: number + p_offset?: number + p_only_highlighted?: boolean + p_supplier_code?: string + } + Returns: { + days_remaining: number + detected_at: string + expires_at: string + is_highlighted: boolean + novelty_id: string + product_id: string + product_name: string + product_sku: string + supplier_code: string + supplier_product_code: string + }[] + } + get_active_step_up_tokens: { Args: never; Returns: Json } + get_ai_generation_stats: { Args: never; Returns: Json } + get_all_material_groups_safe: { + Args: never + Returns: { + description: string + id: string + is_active: boolean + name: string + organization_id: string + slug: string + sort_order: number + }[] + } + get_all_material_types_safe: { + Args: never + Returns: { + description: string + display_order: number + group_id: string + id: string + is_active: boolean + name: string + organization_id: string + properties: Json + slug: string + }[] + } + get_all_product_images: { + Args: { p_product_id: string } + Returns: { + cloudflare_id: string + color_id: string + display_order: number + image_id: string + image_type: string + image_type_category: string + image_type_name: string + is_primary: boolean + show_in_gallery: boolean + show_in_simulator: boolean + url_cdn: string + url_thumbnail: string + }[] + } get_app_health_summary: { Args: { _minutes?: number }; Returns: Json } + get_app_setting: { Args: { p_key: string }; Returns: string } get_auto_test_job_status: { Args: { _limit?: number } Returns: { @@ -6817,6 +32258,27 @@ export type Database = { total_tested: number }[] } + get_automation_stats: { + Args: { p_supplier_id?: string } + Returns: { + metric: string + value: number + }[] + } + get_best_supplier_for_quantity: { + Args: { p_criteria?: string; p_quantity: number; p_variant_id: string } + Returns: { + available_quantity: number + can_fulfill: boolean + lead_time_days: number + recommendation_reason: string + supplier_code: string + supplier_id: string + supplier_name: string + supplier_sku: string + unit_cost: number + }[] + } get_bundle_suggestions: { Args: { _product_id: string } Returns: { @@ -6827,6 +32289,104 @@ export type Database = { product_name: string }[] } + get_category_breadcrumbs: { + Args: { p_category_id: string } + Returns: { + id: string + level: number + name: string + slug: string + }[] + } + get_category_children: { + Args: { p_category_id: string } + Returns: { + children_count: number + display_order: number + id: string + level: number + name: string + products_count: number + slug: string + }[] + } + get_category_colors: { + Args: { p_category_slug: string } + Returns: { + color_group_id: string + color_group_name: string + color_group_slug: string + color_hex: string + display_order: number + is_primary: boolean + variations_count: number + }[] + } + get_category_descendants: { + Args: { p_category_id: string } + Returns: string[] + } + get_category_path: { + Args: { p_category_slug: string } + Returns: { + depth: number + id: string + is_current: boolean + name: string + slug: string + }[] + } + get_category_siblings: { + Args: { p_category_id: string } + Returns: { + display_order: number + id: string + level: number + name: string + slug: string + }[] + } + get_category_tree: { + Args: { + p_max_depth?: number + p_only_active?: boolean + p_root_slug?: string + } + Returns: { + children_count: number + depth: number + id: string + is_leaf: boolean + name: string + parent_id: string + path: string + path_names: string + products_count: number + slug: string + }[] + } + get_category_with_children: { + Args: { p_parent_slug?: string } + Returns: { + description: string + id: string + image_url: string + is_parent: boolean + name: string + products_count: number + slug: string + }[] + } + get_classify_functions: { + Args: never + Returns: { + description: string + function_name: string + is_active: boolean + is_field: string + priority: number + }[] + } get_client_seasonality: { Args: { _client_id: string; _months?: number } Returns: { @@ -6850,15 +32410,107 @@ export type Database = { total_revenue: number }[] } - get_collections_weekly_count: { - Args: { _weeks?: number } + get_cloudflare_image_url: { + Args: { p_base_url: string; p_variant?: string } + Returns: string + } + get_cloudflare_stats: { + Args: never + Returns: { + images_pending: number + images_with_cloudflare: number + last_sync_at: string + sync_errors: number + sync_success: number + total_images: number + total_sync_logs: number + total_videos: number + videos_pending: number + videos_with_cloudflare: number + }[] + } + get_cloudflare_video_embed_url: { + Args: { p_video_id: string } + Returns: string + } + get_cloudflare_video_gif: { + Args: { + p_duration_seconds?: number + p_start_seconds?: number + p_video_id: string + } + Returns: string + } + get_cloudflare_video_hls_url: { + Args: { p_video_id: string } + Returns: string + } + get_cloudflare_video_thumbnail: { + Args: { + p_height?: number + p_time_seconds?: number + p_video_id: string + p_width?: number + } + Returns: string + } + get_collections_weekly_count: { + Args: { _weeks?: number } + Returns: { + item_count: number + week_start: string + }[] + } + get_commemorative_dates_by_product: { + Args: { p_product_id: string } + Returns: { + category: string + color_hex: string + custom_description: string + date_day: number + date_month: number + icon_name: string + id: string + is_featured: boolean + is_product_wide: boolean + name: string + slug: string + variant_color: string + variant_id: string + variant_name: string + }[] + } + get_commemorative_dates_by_variant: { + Args: { p_variant_id: string } Returns: { - item_count: number - week_start: string + category: string + color_hex: string + custom_description: string + date_day: number + date_month: number + icon_name: string + id: string + is_featured: boolean + name: string + slug: string }[] } get_connection_failure_window_minutes: { Args: never; Returns: number } get_connections_auto_test_interval: { Args: never; Returns: number } + get_copywriting_config: { Args: { p_category_id: string }; Returns: Json } + get_cost_for_quantity: { + Args: { + p_quantity: number + p_supplier_id?: string + p_variant_id: string + } + Returns: { + cost_per_unit: number + min_quantity: number + supplier_name: string + tier_number: number + }[] + } get_edge_function_secret: { Args: { _name: string }; Returns: string } get_favorites_weekly_count: { Args: { _weeks?: number } @@ -6867,6 +32519,32 @@ export type Database = { week_start: string }[] } + get_full_scope_grants: { Args: never; Returns: Json } + get_image_full_metadata: { + Args: { p_filename: string; p_supplier_code?: string } + Returns: Json + } + get_image_type_by_suffix: { + Args: { p_filename: string; p_supplier_code?: string } + Returns: { + image_type_code: string + image_type_id: string + image_type_name: string + }[] + } + get_image_url: { + Args: { p_filename: string; p_reference: string; p_supplier?: string } + Returns: string + } + get_image_url_cdn: { + Args: { + p_format?: string + p_height?: number + p_image_id: string + p_width?: number + } + Returns: string + } get_industry_benchmark_stats: { Args: { _company_ids: string[]; _days?: number } Returns: { @@ -6902,10 +32580,272 @@ export type Database = { unique_sellers: number }[] } + get_internal_image_type: { + Args: { p_filename: string; p_supplier_code?: string } + Returns: { + category: string + display_priority: number + image_type_code: string + image_type_id: string + image_type_name: string + is_color_specific: boolean + parsed_data: Json + }[] + } + get_inventory_health: { Args: never; Returns: Json } + get_login_attempts_status: { + Args: { _email?: string; _ip?: string; _window_minutes?: number } + Returns: Json + } + get_material_types_by_group_id: { + Args: { p_group_id: string } + Returns: { + description: string + display_order: number + group_id: string + id: string + is_active: boolean + name: string + organization_id: string + properties: Json + slug: string + }[] + } + get_material_types_by_group_slug: { + Args: { p_group_slug: string } + Returns: { + description: string + display_order: number + group_id: string + id: string + is_active: boolean + name: string + organization_id: string + properties: Json + slug: string + }[] + } + get_materials_complete_safe: { + Args: never + Returns: { + display_order: number + group_id: string + group_name: string + group_slug: string + is_active: boolean + material_description: string + material_id: string + material_name: string + material_slug: string + }[] + } + get_mcp_key_status: { Args: { _key_id: string }; Returns: Json } + get_my_grantor_status: { Args: never; Returns: Json } + get_novelties_stats: { + Args: never + Returns: { + active_novelties: number + expiring_soon: number + highlighted_novelties: number + total_novelties: number + }[] + } + get_pending_images_for_sync: { + Args: { p_limit?: number } + Returns: { + color_id: string + id: string + image_type: string + product_id: string + url_original: string + variant_id: string + }[] + } + get_pending_videos_for_sync: { + Args: { p_limit?: number } + Returns: { + id: string + product_id: string + source_youtube_id: string + title: string + url_original: string + video_type: string + }[] + } get_platform_failure_metrics: { Args: { window_minutes?: number } Returns: Json } + get_price_details: { + Args: { p_quantity?: number; p_variant_id: string } + Returns: { + cost_price: number + margin_percent: number + margin_value: number + markup_percent: number + markup_source: string + min_qty_tier: number + product_name: string + quantity: number + sale_price_total: number + sale_price_unit: number + sku: string + supplier_name: string + tier_used: number + variant_id: string + variant_name: string + }[] + } + get_price_table_for_area: { + Args: { p_height: number; p_technique_code: string; p_width: number } + Returns: string + } + get_product_ai_history: { + Args: { p_product_id: string } + Returns: { + ai_description: string + ai_title: string + generated_at: string + model: string + tokens_used: number + version: number + }[] + } + get_product_composition: { + Args: { p_product_id: string } + Returns: { + group_name: string + material_name: string + part: string + percentage: number + }[] + } + get_product_gallery: { + Args: { p_color_id?: string; p_product_id: string } + Returns: { + cloudflare_id: string + color_id: string + display_order: number + image_id: string + image_type: string + image_type_name: string + is_primary: boolean + url_cdn: string + url_large: string + url_medium: string + url_thumbnail: string + }[] + } + get_product_images_by_type: { + Args: { p_product_id: string; p_type_code: string } + Returns: { + cloudflare_id: string + color_id: string + display_order: number + filename: string + image_id: string + url_cdn: string + url_large: string + url_medium: string + url_thumbnail: string + }[] + } + get_product_media_summary: { + Args: { p_product_id: string } + Returns: { + categoria: string + quantidade: number + tem_principal: boolean + tipo: string + }[] + } + get_product_primary_image: { + Args: { p_product_id: string } + Returns: { + cloudflare_id: string + image_id: string + image_type: string + image_type_name: string + url_cdn: string + url_large: string + url_medium: string + url_thumbnail: string + }[] + } + get_product_primary_video: { + Args: { p_product_id: string } + Returns: { + cloudflare_id: string + duration_seconds: number + title: string + url_embed: string + url_thumbnail: string + video_id: string + }[] + } + get_product_variants_with_prices: { + Args: { p_product_id: string; p_quantity?: number } + Returns: { + calculated_price: number + capacity: string + color_hex: string + color_name: string + id: string + is_active: boolean + size_value: string + sku: string + sku_promo: string + stock_quantity: number + }[] + } + get_products_by_category_colors: { + Args: { + p_category_slug?: string + p_limit?: number + p_offset?: number + p_only_in_stock?: boolean + } + Returns: { + color_group_id: string + color_group_name: string + color_group_slug: string + color_hex: string + color_variation_id: string + color_variation_name: string + image_url: string + price_1: number + product_id: string + product_name: string + product_sku: string + stock_quantity: number + variant_id: string + variant_sku: string + }[] + } + get_products_for_regeneration: { + Args: { + p_limit?: number + p_max_version?: number + p_min_days_old?: number + } + Returns: { + current_version: number + days_since_generation: number + name: string + product_id: string + sku: string + }[] + } + get_products_pending_ai: { + Args: { p_category_id?: string; p_limit?: number } + Returns: { + category_name: string + has_raw_data: boolean + name: string + product_id: string + sku: string + }[] + } get_public_schema_signatures: { Args: never; Returns: Json } get_quote_token_by_value: { Args: { _token: string } @@ -6938,6 +32878,49 @@ export type Database = { isSetofReturn: true } } + get_root_categories: { + Args: never + Returns: { + children_count: number + display_order: number + icon: string + id: string + image_url: string + name: string + products_count: number + slug: string + }[] + } + get_sale_price: { + Args: { p_quantity?: number; p_variant_id: string } + Returns: { + cost_price: number + markup_percent: number + quantity: number + sale_price: number + tier_used: number + variant_id: string + }[] + } + get_sale_price_for_quantity: { + Args: { + p_organization_id?: string + p_quantity: number + p_variant_id: string + } + Returns: { + is_manual_price: boolean + min_quantity: number + price_per_unit: number + tier_number: number + }[] + } + get_step_up_audit: { + Args: { _limit?: number; _user_id?: string } + Returns: Json + } + get_step_up_user_settings: { Args: { _user_id?: string }; Returns: Json } + get_supplier_code: { Args: { p_supplier_id: string }; Returns: string } get_top_collected_products: { Args: { _days?: number; _limit?: number } Returns: { @@ -6959,7 +32942,52 @@ export type Database = { product_id: string }[] } + get_trending_products: { + Args: { p_category_slug?: string; p_days?: number; p_limit?: number } + Returns: { + id: string + min_price: number + name: string + primary_image: string + recent_views: number + sku: string + slug: string + stock_available: number + total_views: number + trend_score: number + }[] + } + get_unprocessed_color_variants: { + Args: { p_color_filter?: string; p_limit?: number; p_offset?: number } + Returns: { + current_color_name: string + current_variation_id: string + image_url: string + product_sku: string + supplier_color_name: string + variant_id: string + variant_sku: string + }[] + } get_unread_count: { Args: never; Returns: number } + get_upcoming_commemorative_dates: { + Args: { p_days_ahead?: number } + Returns: { + campaign_start_days: number + category: string + color_hex: string + date_day: number + date_month: number + days_until: number + icon_name: string + id: string + is_fixed_date: boolean + is_in_campaign: boolean + name: string + slug: string + target_audience: string + }[] + } get_user_org_ids: { Args: { _user_id: string } Returns: { @@ -6977,6 +33005,76 @@ export type Database = { updated_at: string }[] } + get_user_role_history: { Args: { _user_id: string }; Returns: Json } + get_validation_summary: { + Args: { p_days?: number } + Returns: { + percentual: number + quantidade: number + status: string + }[] + } + get_variant_price: { + Args: { p_quantity: number; p_variant_id: string } + Returns: number + } + get_variant_with_suppliers: { + Args: { p_variant_id: string } + Returns: { + color_name: string + product_id: string + product_name: string + supplier_count: number + suppliers: Json + total_stock: number + variant_id: string + variant_name: string + variant_sku: string + }[] + } + get_variants_by_commemorative_date: { + Args: { p_commemorative_date_slug: string; p_limit?: number } + Returns: { + color_hex: string + color_name: string + custom_description: string + display_order: number + is_featured: boolean + is_product_wide: boolean + product_id: string + product_name: string + product_sku: string + variant_id: string + variant_name: string + variant_sku: string + }[] + } + get_variants_for_commemorative_date: { + Args: { + p_include_all_colors?: boolean + p_limit?: number + p_slug: string + } + Returns: { + color_group_id: string + color_group_name: string + color_hex: string + color_name: string + image_url: string + is_primary_color: boolean + price_1: number + product_id: string + product_name: string + product_sku: string + variant_id: string + variant_name: string + variant_sku: string + }[] + } + get_voice_command_stats: { + Args: { _days?: number; _user_id?: string } + Returns: Json + } get_webhook_delivery_summary: { Args: { _minutes?: number } Returns: { @@ -6989,6 +33087,14 @@ export type Database = { total: number }[] } + grant_mcp_full_to_user: { + Args: { _reason: string; _target_user_id: string } + Returns: string + } + has_active_step_up_challenge: { + Args: { _action?: Database["public"]["Enums"]["step_up_action"] } + Returns: boolean + } has_org_role: { Args: { _org_id: string @@ -6997,6 +33103,10 @@ export type Database = { } Returns: boolean } + has_permission: { + Args: { _code: string; _user_id: string } + Returns: boolean + } has_role: { Args: { _role: Database["public"]["Enums"]["app_role"] @@ -7004,14 +33114,98 @@ export type Database = { } Returns: boolean } + hex_to_color_name: { Args: { p_hex: string }; Returns: string } increment_kit_template_usage: { Args: { _template_id: string } - Returns: undefined + Returns: number + } + insert_cloudflare_video: { + Args: { + p_cloudflare_video_id: string + p_duration_seconds?: number + p_height_px?: number + p_is_primary?: boolean + p_product_id: string + p_supplier_code?: string + p_title?: string + p_video_type?: string + p_width_px?: number + } + Returns: string + } + insert_media_from_filename: { + Args: { + p_filename: string + p_is_primary?: boolean + p_reference: string + p_role?: string + p_supplier?: string + p_type?: string + p_variant_sku?: string + } + Returns: string + } + insert_media_from_url: { + Args: { + p_filename?: string + p_is_primary?: boolean + p_reference: string + p_role?: string + p_source_url: string + p_supplier?: string + p_type?: string + p_variant_sku?: string + } + Returns: string + } + insert_or_update_product: { + Args: { + p_organization_id?: string + p_product_data: Json + p_supplier_id: string + p_supplier_reference: string + } + Returns: string + } + insert_product_image_with_type: { + Args: { + p_cloudflare_image_id: string + p_color_id?: string + p_display_order?: number + p_filename: string + p_is_primary?: boolean + p_product_id: string + p_supplier_code?: string + p_url_cdn: string + p_variant_id?: string + } + Returns: string + } + insert_supplier_product_raw: { + Args: { + p_import_batch_id?: string + p_raw_data: Json + p_supplier_id: string + p_supplier_reference: string + } + Returns: string + } + insert_xbz_image_staging: { + Args: { + p_color_name?: string + p_image_url: string + p_item_id: number + p_product_code: string + p_variant_code: string + } + Returns: string } is_admin: | { Args: never; Returns: boolean } - | { Args: { _user_id?: string }; Returns: boolean } + | { Args: { _user_id: string }; Returns: boolean } + is_admin_or_above: { Args: { _user_id?: string }; Returns: boolean } is_admin_strict: { Args: { _user_id?: string }; Returns: boolean } + is_coord_or_above: { Args: { _user_id?: string }; Returns: boolean } is_dev: { Args: { _user_id?: string }; Returns: boolean } is_dnd_active: { Args: never; Returns: boolean } is_kit_collaborator: { @@ -7023,12 +33217,38 @@ export type Database = { Returns: boolean } is_manager_or_admin: { Args: never; Returns: boolean } + is_order_owner: { Args: { p_order_id: string }; Returns: boolean } + is_org_admin: { Args: { org_id: string }; Returns: boolean } is_org_member: { Args: { _org_id: string; _user_id: string } Returns: boolean } + is_org_owner_or_admin: { Args: { org_id: string }; Returns: boolean } is_seller_only: { Args: { _user_id?: string }; Returns: boolean } is_supervisor_or_above: { Args: { _user_id?: string }; Returns: boolean } + kg_to_g: { Args: { p_kg: number }; Returns: number } + l_to_ml: { Args: { p_l: number }; Returns: number } + li_increment_api_usage: { + Args: { p_cost: number; p_provider: string } + Returns: undefined + } + li_upsert_enriched_contact: { + Args: { + p_company: string + p_domain: string + p_email?: string + p_email_confidence?: number + p_email_source?: string + p_first_name: string + p_last_name: string + p_linkedin_url: string + p_phone?: string + p_phone_confidence?: number + p_phone_source?: string + } + Returns: string + } + limpar_nome_produto_spot: { Args: { p_name: string }; Returns: string } log_access_denied: { Args: { _blocked_path: string @@ -7038,6 +33258,15 @@ export type Database = { } Returns: undefined } + log_audit: { + Args: { + _action: string + _details?: Json + _resource_id: string + _resource_type: string + } + Returns: string + } log_full_scope_grant: { Args: { _challenge_id?: string @@ -7055,6 +33284,28 @@ export type Database = { } Returns: string } + log_image_upload: { + Args: { + p_cloudflare_id: string + p_file_size?: number + p_product_id: string + p_source_url: string + p_status?: string + p_url_cdn: string + } + Returns: string + } + log_login_attempt: { + Args: { + _email: string + _failure_reason?: string + _ip?: string + _success: boolean + _user_agent?: string + _user_id?: string + } + Returns: string + } log_rls_denial: { Args: { p_endpoint?: string @@ -7070,9 +33321,56 @@ export type Database = { } Returns: string } + log_step_up_audit: { + Args: { + _action?: Database["public"]["Enums"]["step_up_action"] + _event_type: string + _metadata?: Json + } + Returns: string + } log_user_logout: { Args: never; Returns: undefined } + log_video_upload: { + Args: { + p_cloudflare_id: string + p_file_size?: number + p_product_id: string + p_source_url: string + p_status?: string + p_url_stream: string + } + Returns: string + } + log_voice_command: { + Args: { + _action?: string + _data?: Json + _success?: boolean + _transcript: string + } + Returns: string + } lookup_request_id: { Args: { _request_id: string }; Returns: Json } + m_to_cm: { Args: { p_m: number }; Returns: number } + magic_up_calculate_score: { + Args: { _generation_id: string } + Returns: number + } + magic_up_create_brand_kit: { Args: { _data: Json }; Returns: string } + magic_up_create_campaign: { Args: { _data: Json }; Returns: string } + magic_up_get_brand_kit: { Args: { _kit_id: string }; Returns: Json } + magic_up_get_campaign: { Args: { _campaign_id: string }; Returns: Json } + magic_up_get_dashboard: { Args: never; Returns: Json } + magic_up_increment_metric: { + Args: { _kit_id: string; _metric: string } + Returns: undefined + } + magic_up_save_generation: { Args: { _data: Json }; Returns: string } maintain_webhook_metrics: { Args: never; Returns: undefined } + marcar_alertas_notificados_bitrix: { + Args: { p_bitrix_task_id?: string; p_ids: string[] } + Returns: number + } mark_all_notifications_read: { Args: never; Returns: undefined } mark_notification_read: { Args: { p_notification_id: string } @@ -7083,44 +33381,150 @@ export type Database = { Returns: boolean } mcp_audit_actor: { Args: { _fallback: string }; Returns: string } + mcp_audit_violation: { + Args: { _details?: Json; _key_id: string; _reason: string } + Returns: string + } + mcp_record_access_violation: { + Args: { _details?: Json; _key_id: string; _reason: string } + Returns: string + } + ml_to_l: { Args: { p_ml: number }; Returns: number } + mm_to_cm: { Args: { p_mm: number }; Returns: number } + move_favorites_to_trash: { + Args: { _item_ids: string[] } + Returns: number + } + next_in_step_up_queue: { Args: never; Returns: Json } + normalize_product_name: { Args: { p_name: string }; Returns: string } + normalize_unit: { + Args: { p_source_unit: string; p_target_unit: string; p_value: number } + Returns: number + } notify_hardening_regression: { Args: never; Returns: Json } - purge_expired_security_data: { Args: never; Returns: undefined } - purge_expired_step_up_artifacts: { + org_has_any_members: { Args: { _org_id: string }; Returns: boolean } + ownership_audit: { Args: { _triggered_by?: string }; Returns: string } + ownership_check_orphans: { Args: never; Returns: Json } + ownership_repair: { + Args: { _dry_run?: boolean; _report_id: string } + Returns: Json + } + parse_asia_categories: { Args: { p_raw_data: Json }; Returns: Json } + parse_asia_colors: { Args: { p_raw_data: Json }; Returns: Json } + parse_asia_dimensions: { Args: { p_raw_data: Json }; Returns: Json } + parse_asia_media: { Args: { p_raw_data: Json }; Returns: Json } + parse_asia_price: { Args: { p_raw_data: Json }; Returns: number } + parse_asia_stock: { Args: { p_raw_data: Json }; Returns: number } + parse_asia_tags: { Args: { p_raw_data: Json }; Returns: Json } + parse_supplier_image_filename: { + Args: { p_filename: string; p_supplier_code?: string } + Returns: Json + } + parse_unit_from_string: { + Args: { p_input: string } + Returns: Record + } + parse_xbz_dimensions: { Args: { p_raw_data: Json }; Returns: Json } + populate_import_staging: { + Args: { + p_batch_id?: string + p_filenames: string[] + p_source_zip?: string + } + Returns: { + total_already_exists: number + total_area: number + total_component: number + total_location: number + total_no_color: number + total_no_product: number + total_pending: number + total_processado: number + total_skipped: number + }[] + } + populate_media_from_products: { + Args: { p_supplier?: string } + Returns: { + inserted: number + skipped: number + updated: number + }[] + } + process_pending_batches: { + Args: never + Returns: { + batch_id: string + products_processed: number + status: string + }[] + } + process_spot_products: { + Args: { p_batch_size?: number } + Returns: { + prod_reference: string + product_id: string + status: string + variants_created: number + }[] + } + process_step_up_queue: { Args: never; Returns: number } + process_supplier_product: { Args: { - _challenge_grace_minutes?: number - _token_grace_minutes?: number + p_raw_data: Json + p_supplier_id: string + p_supplier_reference: string } + Returns: Json + } + process_supplier_product_data: { + Args: { p_raw_data: Json; p_supplier_id: string } + Returns: Json + } + process_supplier_products_batch: { + Args: { p_limit?: number; p_supplier_id: string } Returns: { - challenges_deleted: number - tokens_deleted: number + error_message: string + processed_at: string + product_id: string + staging_id: string + success: boolean + supplier_reference: string + variants_created: number }[] } + purge_edge_invocations_old: { Args: never; Returns: number } + purge_expired_security_data: { Args: never; Returns: undefined } + purge_expired_step_up_artifacts: { Args: never; Returns: number } + purge_favorite_trash_old: { Args: never; Returns: number } purge_old_audit_logs: { Args: never; Returns: undefined } - record_app_vital: - | { - Args: { - _name: string - _rating?: string - _req_id?: string - _ua?: string - _uid?: string - _url?: string - _value: number - } - Returns: undefined - } - | { - Args: { - _name: string - _rating: string - _req_id: string - _ua: string - _uid?: string - _url: string - _value: number - } - Returns: undefined - } + purge_old_login_attempts: { Args: never; Returns: number } + purge_old_rate_limits: { Args: never; Returns: number } + rate_limit_check: { + Args: { + _endpoint: string + _identifier: string + _max_requests?: number + _window_seconds?: number + } + Returns: Json + } + recalculate_sale_prices: { + Args: { p_organization_id?: string; p_variant_id?: string } + Returns: number + } + record_app_vital: { + Args: { + _name: string + _rating?: string + _req_id?: string + _ua?: string + _uid?: string + _url?: string + _value: number + } + Returns: undefined + } record_auth_attempt: { Args: { _email: string @@ -7178,6 +33582,112 @@ export type Database = { } Returns: undefined } + record_schema_drift_result: { Args: { p_result: Json }; Returns: string } + refresh_full_scope_grants_view: { Args: never; Returns: undefined } + refresh_materialized_views: { Args: never; Returns: undefined } + register_ai_routing_decision: { + Args: { + p_attempted_models: string[] + p_attempted_outcomes: Json + p_attempted_providers: string[] + p_final_model_id: string + p_final_provider_id: string + p_function_name: string + p_outcome: string + p_request_id?: string + p_total_attempts: number + p_total_duration_ms: number + p_usage_log_id?: string + p_user_id: string + } + Returns: string + } + register_classify_function: { + Args: { + p_description?: string + p_function_name: string + p_is_field: string + p_priority?: number + } + Returns: Json + } + register_cloudflare_image: { + Args: { + p_cloudflare_image_id: string + p_color_id?: string + p_display_order?: number + p_file_size_bytes?: number + p_filename?: string + p_format?: string + p_height_px?: number + p_image_type?: string + p_is_primary?: boolean + p_product_id: string + p_source_supplier?: string + p_url_cdn: string + p_url_original?: string + p_variant_id?: string + p_width_px?: number + } + Returns: string + } + register_cloudflare_video: { + Args: { + p_cloudflare_video_id: string + p_display_order?: number + p_duration_seconds?: number + p_file_size_bytes?: number + p_filename?: string + p_height_px?: number + p_is_primary?: boolean + p_product_id: string + p_source_supplier?: string + p_source_youtube_id?: string + p_title?: string + p_url_dash?: string + p_url_hls?: string + p_url_original?: string + p_url_stream: string + p_url_thumbnail?: string + p_video_type?: string + p_width_px?: number + } + Returns: string + } + registrar_entrada_estoque: { + Args: { + p_document_number?: string + p_notes?: string + p_quantity: number + p_supplier_name?: string + p_unit_cost?: number + p_user_id?: string + p_variant_sku: string + } + Returns: Json + } + registrar_mudancas_preco_spot: { + Args: { p_dados_api: Json } + Returns: { + atencao: number + criticos: number + info: number + total_mudancas: number + urgentes: number + }[] + } + registrar_saida_estoque: { + Args: { + p_allow_negative?: boolean + p_document_number?: string + p_movement_type?: string + p_notes?: string + p_quantity: number + p_user_id?: string + p_variant_sku: string + } + Returns: Json + } repair_ownership_orphans: { Args: { _dry_run?: boolean @@ -7186,6 +33696,39 @@ export type Database = { } Returns: Json } + reprocess_all_automations: { + Args: { p_batch_size?: number; p_supplier_id?: string } + Returns: { + dates_linked: number + eco_marked: number + feminine_marked: number + processed: number + properties_linked: number + tags_linked: number + }[] + } + reprocess_all_products: { + Args: { + p_batch_size?: number + p_force_reclassify?: boolean + p_supplier_id?: string + } + Returns: { + classified: number + errors: number + materials_linked: number + prices_calculated: number + processed: number + }[] + } + reprocess_product_materials: { + Args: { p_batch_size?: number; p_supplier_id?: string } + Returns: { + materials_linked: number + processed: number + products_with_materials: number + }[] + } request_step_up_challenge: { Args: { _action: Database["public"]["Enums"]["step_up_action"] @@ -7199,12 +33742,87 @@ export type Database = { otp_plain: string }[] } + reset_mockup_credit_limits: { Args: never; Returns: undefined } reset_optimization_queue: { Args: { _only_running?: boolean } Returns: number } + reset_user_step_up_state: { + Args: { _user_id: string } + Returns: undefined + } + restore_collection_item_from_trash: { + Args: { _item_id: string } + Returns: boolean + } + restore_favorite_item_from_trash: { + Args: { _item_id: string } + Returns: boolean + } + restore_product: { Args: { p_product_id: string }; Returns: boolean } retry_failed_webhook_deliveries: { Args: never; Returns: Json } revoke_all_user_tokens: { Args: { _user_id: string }; Returns: undefined } + revoke_mcp_full_from_user: { + Args: { _target_user_id: string } + Returns: number + } + revoke_user_step_up: { Args: { _user_id: string }; Returns: undefined } + rls_matrix_export: { Args: never; Returns: Json } + rotate_mcp_key: { + Args: { + _key_id: string + _new_key_hash: string + _new_key_prefix: string + } + Returns: string + } + save_step_up_audit: { + Args: { + _action?: Database["public"]["Enums"]["step_up_action"] + _event_type: string + _metadata?: Json + } + Returns: string + } + search_notebooks_by_size: { + Args: { + p_format_code?: string + p_height?: number + p_tolerance?: number + p_width?: number + } + Returns: { + format_code: string + height_cm: number + product_id: string + product_name: string + width_cm: number + }[] + } + search_products_fulltext: { + Args: { + p_category_slug?: string + p_limit?: number + p_max_price?: number + p_min_price?: number + p_offset?: number + p_only_in_stock?: boolean + p_search_term: string + } + Returns: { + category_name: string + description: string + id: string + image_url: string + match_highlights: string + min_price: number + name: string + relevance: number + sku: string + slug: string + total_stock: number + }[] + } search_products_semantic: { Args: { _limit?: number; _products: Json; _query: string } Returns: { @@ -7221,6 +33839,14 @@ export type Database = { score: number }[] } + search_suggestions: { + Args: { p_limit?: number; p_partial_term: string } + Returns: { + count: number + suggestion: string + suggestion_type: string + }[] + } seed_discount_test_users: { Args: never; Returns: Json } set_connection_failure_window_minutes: { Args: { minutes: number } @@ -7230,11 +33856,41 @@ export type Database = { Args: { minutes: number } Returns: number } + sincronizar_estoque_spot: { + Args: { p_stock_data: Json; p_user_id?: string } + Returns: Json + } + slugify: { Args: { input_text: string }; Returns: string } snapshot_hardening_status: { Args: never; Returns: Json } + soft_delete_product: { Args: { p_product_id: string }; Returns: boolean } + soft_delete_quote: { Args: { _quote_id: string }; Returns: undefined } start_step_up_challenge: { Args: { _action: string; _target_ref?: string } Returns: string } + step_up_challenge_create: { + Args: { + _action: Database["public"]["Enums"]["step_up_action"] + _target_ref?: string + } + Returns: string + } + step_up_challenge_verify: { + Args: { _challenge_id: string; _otp: string } + Returns: boolean + } + step_up_token_create: { Args: { _challenge_id: string }; Returns: string } + step_up_token_revoke: { Args: { _token_id: string }; Returns: undefined } + step_up_user_settings_get: { Args: { _user_id?: string }; Returns: Json } + step_up_user_settings_set: { + Args: { _settings: Json; _user_id?: string } + Returns: undefined + } + store_user_token_revocation: { + Args: { _user_id: string } + Returns: undefined + } + strip_html: { Args: { input_text: string }; Returns: string } submit_quote_response: { Args: { _response: string; _response_notes?: string; _token: string } Returns: boolean @@ -7249,6 +33905,93 @@ export type Database = { } Returns: Json } + test_classify_batch: { + Args: { product_names: string[] } + Returns: { + category_slug: string + confidence: string + material: string + product_name: string + tipo_detectado: string + }[] + } + toggle_user_step_up: { + Args: { _enabled: boolean; _user_id: string } + Returns: undefined + } + track_voice_command: { Args: { _transcript: string }; Returns: string } + truncate_text: { + Args: { input_text: string; max_length: number; suffix?: string } + Returns: string + } + unblock_ip: { Args: { _ip: string }; Returns: number } + update_image_after_sync: { + Args: { + p_cloudflare_image_id: string + p_file_size_bytes?: number + p_format?: string + p_height_px?: number + p_image_id: string + p_url_cdn: string + p_width_px?: number + } + Returns: boolean + } + update_preferred_suppliers: { + Args: { p_variant_id?: string } + Returns: { + updated_count: number + variants_processed: number + }[] + } + update_step_up_user_settings: { + Args: { _settings: Json; _user_id?: string } + Returns: undefined + } + update_video_after_sync: { + Args: { + p_cloudflare_video_id: string + p_duration_seconds?: number + p_height_px?: number + p_url_dash?: string + p_url_hls?: string + p_url_stream: string + p_url_thumbnail?: string + p_video_id: string + p_width_px?: number + } + Returns: boolean + } + update_video_from_cloudflare: { + Args: { + p_cloudflare_video_id: string + p_duration_seconds?: number + p_error_message?: string + p_height_px?: number + p_status: string + p_thumbnail_url?: string + p_width_px?: number + } + Returns: boolean + } + user_belongs_to_org: { Args: { org_id: string }; Returns: boolean } + user_can_skip_step_up: { Args: { _user_id?: string }; Returns: boolean } + user_is_org_member: { Args: { org_id: string }; Returns: boolean } + validate_image_requirements: { + Args: { + p_file_size_bytes?: number + p_format?: string + p_height: number + p_supplier_code?: string + p_width: number + } + Returns: { + is_valid: boolean + issues: string[] + recommendations: string[] + validation_status: string + }[] + } validate_mcp_key: { Args: { _key_plain: string } Returns: { @@ -7258,45 +34001,114 @@ export type Database = { scopes: string[] }[] } - verify_step_up_otp: { - Args: { _challenge_id: string; _otp_attempt: string } + validate_product_total_percentage: { + Args: { p_product_id: string } Returns: boolean } + validate_video_requirements: { + Args: { + p_duration_seconds?: number + p_file_size_bytes?: number + p_height: number + p_supplier_code?: string + p_width: number + } + Returns: { + is_valid: boolean + issues: string[] + recommendations: string[] + validation_status: string + }[] + } + vault_delete_secret: { Args: { p_name: string }; Returns: boolean } + vault_get_secret: { Args: { p_name: string }; Returns: string } + vault_list_secret_names: { + Args: never + Returns: { + created_at: string + description: string + name: string + updated_at: string + }[] + } + vault_set_secret: { + Args: { p_description?: string; p_name: string; p_value: string } + Returns: string + } + verify_step_up_otp: { + Args: { _challenge_id: string; _otp: string } + Returns: { + expires_at: string + token: string + }[] + } verify_step_up_password: { Args: { _challenge_id: string; _password_attempt: string } Returns: boolean } + verify_user_step_up_required: { + Args: { + _action: Database["public"]["Enums"]["step_up_action"] + _user_id?: string + } + Returns: boolean + } } Enums: { app_role: + | "dev" + | "supervisor" | "admin" | "manager" - | "vendedor" - | "supervisor" - | "dev" | "agente" | "coordenador" + | "vendedor" + categoria_cor_enum: + | "pantone" + | "basica" + | "institucional" + | "especial" + | "bordado" + | "hot_stamping" + | "serigrafia" + | "sublimacao" conversation_event_type: | "text" | "image" + | "audio" + | "video" | "file" | "system" - | "tool_call" - | "tool_result" + familia_cor_enum: + | "amarelo" + | "laranja" + | "vermelho" + | "coral" + | "rosa" + | "magenta" + | "roxo" + | "lilas" + | "azul" + | "ciano" + | "verde" + | "marrom" + | "bege" + | "neutro" + | "metalico" org_role: "owner" | "admin" | "member" - role_migration_item_status: + payment_status: | "pending" - | "success" + | "authorized" + | "captured" + | "refunded" | "failed" - | "skipped" - | "dry_run" + role_migration_item_status: "pending" | "success" | "failed" | "skipped" role_migration_status: | "pending" | "running" | "completed" | "failed" - | "partial" - | "dry_run" + | "cancelled" step_up_action: | "promote_dev" | "demote_dev" @@ -7306,9 +34118,61 @@ export type Database = { | "secret_revoke" | "mcp_key_revoke" | "mcp_key_rotate" + tipo_cor_enum: + | "solid" + | "metalica" + | "fluorescente" + | "pastel" + | "neon" + | "especial" } CompositeTypes: { - [_ in never]: never + resultado_calculo_personalizacao: { + tecnica_mae_codigo: string | null + tecnica_mae_nome: string | null + variante_codigo: string | null + variante_nome: string | null + table_code: string | null + quantidade: number | null + num_cores: number | null + area_cm2: number | null + preco_custo_unitario: number | null + custo_total: number | null + markup_percent: number | null + preco_venda_unitario: number | null + valor_gravacao: number | null + setup_base: number | null + cobra_por_cor: boolean | null + setup_total: number | null + total_cobrado: number | null + preco_por_peca_efetivo: number | null + usou_setup_minimo: boolean | null + economia_cliente: number | null + preco_minimo_unitario: number | null + aplicou_preco_minimo: boolean | null + faixa_usada: number | null + fonte_preco: string | null + mensagem: string | null + } + resultado_preco_personalizacao: { + table_code: string | null + tecnica_codigo: string | null + tecnica_nome: string | null + quantidade: number | null + area_cm2: number | null + faixa_utilizada: number | null + preco_unitario_custo: number | null + preco_unitario_venda: number | null + multiplicador_area: number | null + markup_percent: number | null + custo_setup: number | null + custo_handling: number | null + subtotal_custo: number | null + subtotal_venda: number | null + total_com_setup: number | null + sucesso: boolean | null + mensagem: string | null + } } } } @@ -7434,37 +34298,64 @@ export const Constants = { public: { Enums: { app_role: [ + "dev", + "supervisor", "admin", "manager", - "vendedor", - "supervisor", - "dev", "agente", "coordenador", + "vendedor", + ], + categoria_cor_enum: [ + "pantone", + "basica", + "institucional", + "especial", + "bordado", + "hot_stamping", + "serigrafia", + "sublimacao", ], conversation_event_type: [ "text", "image", + "audio", + "video", "file", "system", - "tool_call", - "tool_result", + ], + familia_cor_enum: [ + "amarelo", + "laranja", + "vermelho", + "coral", + "rosa", + "magenta", + "roxo", + "lilas", + "azul", + "ciano", + "verde", + "marrom", + "bege", + "neutro", + "metalico", ], org_role: ["owner", "admin", "member"], - role_migration_item_status: [ + payment_status: [ "pending", - "success", + "authorized", + "captured", + "refunded", "failed", - "skipped", - "dry_run", ], + role_migration_item_status: ["pending", "success", "failed", "skipped"], role_migration_status: [ "pending", "running", "completed", "failed", - "partial", - "dry_run", + "cancelled", ], step_up_action: [ "promote_dev", @@ -7476,6 +34367,14 @@ export const Constants = { "mcp_key_revoke", "mcp_key_rotate", ], + tipo_cor_enum: [ + "solid", + "metalica", + "fluorescente", + "pastel", + "neon", + "especial", + ], }, }, } as const diff --git a/src/lib/external-db/kill-switch-client.ts b/src/lib/external-db/kill-switch-client.ts index fe81e902a..5a4afce2c 100644 --- a/src/lib/external-db/kill-switch-client.ts +++ b/src/lib/external-db/kill-switch-client.ts @@ -16,8 +16,8 @@ import { supabase } from '@/integrations/supabase/client'; import { logger } from '@/lib/logger'; -const MEM_TTL_MS = 60_000; // 60s — alinhado ao cache do helper back-end -const STORAGE_TTL_MS = 300_000; // 5min — sobrevive reload/aba +const MEM_TTL_MS = 60_000; // 60s — alinhado ao cache do helper back-end +const STORAGE_TTL_MS = 300_000; // 5min — sobrevive reload/aba const STORAGE_KEY_PREFIX = 'kill_switch:'; type SwitchCheck = { @@ -87,19 +87,16 @@ export async function getKillSwitchState(switchName: string): Promise { const toSend = buffer.splice(0, BUFFER_MAX_SIZE); try { - // Cast: kill_switch_hits foi criada após o último gen-types; quando rodar - // `supabase gen types` o cast pode ser removido. - // deno-lint-ignore no-explicit-any - const client = supabase as any; - const { error } = await client.from('kill_switch_hits').insert(toSend); + const { error } = await supabase.from('kill_switch_hits').insert(toSend); if (error) { // Em caso de erro, devolve ao buffer (limitado para evitar crescimento) - logger.warn(`[kill-switch-telemetry] flush falhou (${toSend.length} eventos descartados ou re-enfileirados): ${error.message}`); + logger.warn( + `[kill-switch-telemetry] flush falhou (${toSend.length} eventos descartados ou re-enfileirados): ${error.message}`, + ); buffer = [...toSend.slice(0, MAX_RETAINED_ON_FAILURE - buffer.length), ...buffer]; } } catch (e) { @@ -122,6 +120,7 @@ export async function flushKillSwitchTelemetry(): Promise { * Reset apenas para testes. * @internal */ +// eslint-disable-next-line @typescript-eslint/naming-convention -- helper de teste com prefixo __ (mesmo padrão de __resetSchemaStatsForTests) export function __resetKillSwitchTelemetry(): void { if (flushTimer) { clearTimeout(flushTimer); diff --git a/src/lib/supabase-untyped.ts b/src/lib/supabase-untyped.ts index 3352e9cba..1cdef6fea 100644 --- a/src/lib/supabase-untyped.ts +++ b/src/lib/supabase-untyped.ts @@ -1 +1,60 @@ -LyoqCiAqIFR5cGVkIHdyYXBwZXIgZm9yIFN1cGFiYXNlIHRhYmxlcyBub3QgeWV0IGluIHRoZSBnZW5lcmF0ZWQgc2NoZW1hLgogKiBFbGltaW5hdGVzIGBhcyBhbnlgIGNhc3RzIGF0IGNhbGwgc2l0ZXMgd2hpbGUgbWFpbnRhaW5pbmcgdHlwZSBzYWZldHkuCiAqCiAqIFVzYWdlOgogKiAgIGNvbnN0IHsgZGF0YSB9ID0gYXdhaXQgdW50eXBlZEZyb208TXlUeXBlPigibXlfdGFibGUiKS5zZWxlY3QoIioiKS5lcSgiaWQiLCBpZCk7CiAqICAgLy8gICAgICAgICAgICAgIGRhdGEgaXMgTXlUeXBlW10gKGZyb20gZ2VuZXJpYyksIG5vdCBuZXZlcltdCiAqCiAqIFN0cmF0ZWd5OgogKiAgIFRoZSBTdXBhYmFzZSBnZW5lcmF0ZWQgdHlwZXMgbmFycm93IGBmcm9tKClgIHRvIGtub3duIHRhYmxlIG5hbWVzIOKAlCBhbnkKICogICBvdGhlciBzdHJpbmcgZmFsbHMgYmFjayB0byBgYXVkaXRfbG9nc2Agcm93IHNoYXBlLCB3aGljaCBjYXVzZXMgVFMyMzM5CiAqICAgZmxvb2RzIG9uIGV2ZXJ5IHByb3BlcnR5IGFjY2Vzcy4gQ2FzdGluZyBgc3VwYWJhc2VgIGl0c2VsZiB0byBhCiAqICAgcGVybWlzc2l2ZSBgU3VwYWJhc2VDbGllbnQ8YW55PmAgcmVzdG9yZXMgdGhlIHVucmVzdHJpY3RlZCBidWlsZGVyIHNvCiAqICAgdGhlIHJvdy1zaGFwZSBnZW5lcmljIGBUYCBmbG93cyB0aHJvdWdoIGBzZWxlY3QoKS9pbnNlcnQoKS91cGRhdGUoKWAuCiAqCiAqIE1JR1JBVElPTiBOT1RFIChwb3N0LWNvbGFwc28gMjAyNi0wNS0yNCk6CiAqICAgVGhlIDUgdGFibGVzIHByZXZpb3VzbHkgbGlzdGVkIGluIFVudHlwZWRUYWJsZSBiZWxvdyBub3cgZXhpc3QgaW4gdGhlCiAqICAgZGF0YWJhc2UgKFBScyAjMzE1IGFuZCAjMzE3KS4gT25jZSBgc3VwYWJhc2UgZ2VuIHR5cGVzIHR5cGVzY3JpcHRgIGlzCiAqICAgcmUtcnVuIGFuZCB0eXBlcy50cyB1cGRhdGVkLCB0aGUgcmVtYWluaW5nIGB1bnR5cGVkRnJvbSgiLi4uIilgIGNhbGwKICogICBzaXRlcyBpbiBzcmMvIHNob3VsZCBtaWdyYXRlIHRvIGBzdXBhYmFzZS5mcm9tKCIuLi4iKWAgZm9yIGZ1bGwgdHlwZQogKiAgIHNhZmV0eS4gVGhpcyBmaWxlIHN0YXlzIGFzIGEgc2FmZXR5IG5ldCBmb3IgZnV0dXJlIHRhYmxlcyB0aGF0IGhhdmVuJ3QKICogICBsYW5kZWQgaW4gdGhlIGdlbmVyYXRlZCBzY2hlbWEgeWV0LgogKgogKiAgIENJIGd1YXJkOiBgLmdpdGh1Yi93b3JrZmxvd3MvbGludC11bnR5cGVkLWZyb20ueW1sYCBmYWlscyB0aGUgYnVpbGQgaWYKICogICBhbnkgYHVudHlwZWRGcm9tKCJYIilgIGNhbGwgcmVmZXJlbmNlcyBhIHRhYmxlIE5PVCBpbiB0eXBlcy50cyDigJQKICogICB3aGljaCBpcyB0aGUgcHJlY2lzZSBjb25kaXRpb24gdGhhdCBjYXVzZWQgYSAyMDI2LTA1LTI0IHNpbGVudAogKiAgIGZhaWx1cmVzICh0YWJsZXMgbWlzc2luZyBmcm9tIHRoZSBkYXRhYmFzZSkuCiAqLwppbXBvcnQgdHlwZSB7IFN1cGFiYXNlQ2xpZW50IH0gZnJvbSAiQHN1cGFiYXNlL3N1cGFiYXNlLWpzIjsKaW1wb3J0IHsgc3VwYWJhc2UgfSBmcm9tICJAL2ludGVncmF0aW9ucy9zdXBhYmFzZS9jbGllbnQiOwoKLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby1leHBsaWNpdC1hbnkgLS0gbmVlZGVkIGZvciBwZXJtaXNzaXZlIFN1cGFiYXNlQ2xpZW50IGNhc3QgKHNlZSBmaWxlIGhlYWRlcikKdHlwZSBBbnlDbGllbnQgPSBTdXBhYmFzZUNsaWVudDxhbnksIGFueSwgYW55PjsKCi8qKgogKiBBY2Nlc3MgYSBTdXBhYmFzZSB0YWJsZSB0aGF0IGRvZXNuJ3QgZXhpc3QgaW4gdGhlIGdlbmVyYXRlZCB0eXBlcy4KICoKICogUGFzcyB0aGUgcm93IHNoYXBlIGFzIGBUYCB0byByZWNvdmVyIGZ1bGwgdHlwaW5nIG9uIGAuc2VsZWN0KClgLAogKiBgLmluc2VydCgpYCwgYC51cGRhdGUoKWAg4oCUIG90aGVyd2lzZSBmYWxscyBiYWNrIHRvIGEgcGVybWlzc2l2ZQogKiBgUmVjb3JkPHN0cmluZywgdW5rbm93bj5gIHRoYXQgaXMgc3RpbGwgc2FmZXIgdGhhbiBgYW55YC4KICovCmV4cG9ydCBmdW5jdGlvbiB1bnR5cGVkRnJvbTxUID0gUmVjb3JkPHN0cmluZywgdW5rbm93bj4+KHRhYmxlOiBzdHJpbmcpIHsKICByZXR1cm4gKHN1cGFiYXNlIGFzIHVua25vd24gYXMgQW55Q2xpZW50KS5mcm9tKHRhYmxlKSBhcyBSZXR1cm5UeXBlPAogICAgQW55Q2xpZW50WyJmcm9tIl0KICA+ICYgeyBfcm93PzogVCB9Owp9CgovKioKICogS25vd24gdW50eXBlZCB0YWJsZSBuYW1lcyBmb3IgZG9jdW1lbnRhdGlvbi4KICoKICogQWxsIGVudHJpZXMgaGVyZSBzaG91bGQgYWxzbyBleGlzdCBpbiB0aGUgZGF0YWJhc2UgKHZhbGlkYXRlZCBieSBDSSkuCiAqIFdoZW4gYSBuYW1lIGlzIGFkZGVkIGhlcmUgT1IgYSBuZXcgYHVudHlwZWRGcm9tKCJYIilgIGNhbGwgaXMgYWRkZWQgaW4KICogc3JjLywgdGhlIGxpbnQgam9iIHdpbGwgZmFpbCB1bmxlc3MgWCBhbHNvIGFwcGVhcnMgaW4KICogc3JjL2ludGVncmF0aW9ucy9zdXBhYmFzZS90eXBlcy50cyAoaS5lLiB0aGUgc2NoZW1hIHdhcyByZWdlbmVyYXRlZCkuCiAqCiAqIEVtcHR5IHNpbmNlIHRoZSAyMDI2LTA1LTI0IGNsZWFudXAg4oCUIHRoZSA1IHByZXZpb3VzIGVudHJpZXMgbm93IGV4aXN0CiAqIGluIHRoZSBkYXRhYmFzZSBhbmQgc2hvdWxkIGJlIG1pZ3JhdGVkIHRvIGBzdXBhYmFzZS5mcm9tKClgIG9uY2UKICogdHlwZXMudHMgaXMgcmVnZW5lcmF0ZWQuCiAqLwpleHBvcnQgdHlwZSBVbnR5cGVkVGFibGUgPSBuZXZlcjsK \ No newline at end of file +/** + * Typed wrapper for Supabase tables not yet in the generated schema. + * Eliminates `as any` casts at call sites while maintaining type safety. + * + * Usage: + * const { data } = await untypedFrom("my_table").select("*").eq("id", id); + * // data is MyType[] (from generic), not never[] + * + * Strategy: + * The Supabase generated types narrow `from()` to known table names — any + * other string falls back to `audit_logs` row shape, which causes TS2339 + * floods on every property access. Casting `supabase` itself to a + * permissive `SupabaseClient` restores the unrestricted builder so + * the row-shape generic `T` flows through `select()/insert()/update()`. + * + * MIGRATION NOTE (post-colapso 2026-05-24): + * The 5 tables previously listed in UntypedTable below now exist in the + * database (PRs #315 and #317). Once `supabase gen types typescript` is + * re-run and types.ts updated, the remaining `untypedFrom("...")` call + * sites in src/ should migrate to `supabase.from("...")` for full type + * safety. This file stays as a safety net for future tables that haven't + * landed in the generated schema yet. + * + * CI guard: `.github/workflows/lint-untyped-from.yml` fails the build if + * any `untypedFrom("X")` call references a table NOT in types.ts — + * which is the precise condition that caused a 2026-05-24 silent + * failures (tables missing from the database). + */ +import type { SupabaseClient } from '@supabase/supabase-js'; +import { supabase } from '@/integrations/supabase/client'; + +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- needed for permissive SupabaseClient cast (see file header) +type AnyClient = SupabaseClient; + +/** + * Access a Supabase table that doesn't exist in the generated types. + * + * Pass the row shape as `T` to recover full typing on `.select()`, + * `.insert()`, `.update()` — otherwise falls back to a permissive + * `Record` that is still safer than `any`. + */ +export function untypedFrom>(table: string) { + return (supabase as unknown as AnyClient).from(table) as ReturnType & { + _row?: T; + }; +} + +/** + * Known untyped table names for documentation. + * + * All entries here should also exist in the database (validated by CI). + * When a name is added here OR a new `untypedFrom("X")` call is added in + * src/, the lint job will fail unless X also appears in + * src/integrations/supabase/types.ts (i.e. the schema was regenerated). + * + * Empty since the 2026-05-24 cleanup — the 5 previous entries now exist + * in the database and should be migrated to `supabase.from()` once + * types.ts is regenerated. + */ +export type UntypedTable = never;