package sageintacct

import (
	"fmt"
	"strings"

	"github.com/amp-labs/connectors/common"
	"github.com/amp-labs/connectors/internal/components"
)

// API reference: https://developer.sage.com/intacct/docs/openapi/z-indexes/
// nolint:funlen,maintidx
func supportedOperations() components.EndpointRegistryInput {
	readWriteSupport := []string{
		"accounts-payable/account-label",
		"accounts-payable/adjustment",
		"accounts-payable/adjustment-line",
		"accounts-payable/adjustment-summary",
		"accounts-payable/adjustment-tax-entry",
		"accounts-payable/advance",
		"accounts-payable/advance-line",
		"accounts-payable/bill",
		"accounts-payable/bill-line",
		"accounts-payable/bill-summary",
		"accounts-payable/bill-tax-entry",
		"accounts-payable/check-run",
		"accounts-payable/joint-payee",
		"accounts-payable/payment",
		"accounts-payable/payment-detail",
		"accounts-payable/payment-line",
		"accounts-payable/recurring-bill",
		"accounts-payable/recurring-bill-line",
		"accounts-payable/recurring-bill-tax-entry",
		"accounts-payable/summary",
		"accounts-payable/term",
		"accounts-payable/vendor",
		"accounts-payable/vendor-account-number",
		"accounts-payable/vendor-bank-file-setup",
		"accounts-payable/vendor-contact",
		"accounts-payable/vendor-email-template",
		"accounts-payable/vendor-group",
		"accounts-payable/vendor-payment-provider",
		"accounts-payable/vendor-restricted-department",
		"accounts-payable/vendor-restricted-location",
		"accounts-payable/vendor-total",
		"accounts-payable/vendor-type",
		"accounts-receivable/account-label",
		"accounts-receivable/adjustment",
		"accounts-receivable/adjustment-line",
		"accounts-receivable/adjustment-tax-entry",
		"accounts-receivable/advance",
		"accounts-receivable/advance-line",
		"accounts-receivable/billback-template",
		"accounts-receivable/billback-template-line",
		"accounts-receivable/customer",
		"accounts-receivable/customer-account-group",
		"accounts-receivable/customer-contact",
		"accounts-receivable/customer-email-template",
		"accounts-receivable/customer-group",
		"accounts-receivable/customer-item-cross-reference",
		"accounts-receivable/customer-message",
		"accounts-receivable/customer-restricted-department",
		"accounts-receivable/customer-restricted-location",
		"accounts-receivable/customer-total",
		"accounts-receivable/customer-type",
		"accounts-receivable/delivery-history",
		"accounts-receivable/dunning-customer",
		"accounts-receivable/dunning-invoice",
		"accounts-receivable/dunning-level",
		"accounts-receivable/dunning-notice",
		"accounts-receivable/invoice",
		"accounts-receivable/invoice-line",
		"accounts-receivable/invoice-summary",
		"accounts-receivable/invoice-tax-entry",
		"accounts-receivable/manual-deposit",
		"accounts-receivable/manual-deposit-line",
		"accounts-receivable/manual-deposit-summary",
		"accounts-receivable/payment",
		"accounts-receivable/payment-detail",
		"accounts-receivable/payment-line",
		"accounts-receivable/payment-summary",
		"accounts-receivable/recurring-invoice",
		"accounts-receivable/recurring-invoice-line",
		"accounts-receivable/recurring-invoice-tax-entry",
		"accounts-receivable/revenue-recognition-template",
		"accounts-receivable/shipping-method",
		"accounts-receivable/summary",
		"accounts-receivable/term",
		"accounts-receivable/territory",
		"cash-management/ar-advance-txn-line-template",
		"cash-management/ar-advance-txn-template",
		"cash-management/bank-fee",
		"cash-management/bank-fee-line",
		"cash-management/bank-fee-tax-entry",
		"cash-management/bank-file",
		"cash-management/bank-file-detail",
		"cash-management/bank-txn-assignment-rule",
		"cash-management/bank-txn-assignment-rule-filter",
		"cash-management/bank-txn-rule",
		"cash-management/bank-txn-rule-filter",
		"cash-management/bank-txn-rule-group",
		"cash-management/bank-txn-rule-map",
		"cash-management/bank-txn-rule-match",
		"cash-management/bank-txn-rule-set",
		"cash-management/checking-account",
		"cash-management/credit-card-account",
		"cash-management/credit-card-fee",
		"cash-management/credit-card-fee-line",
		"cash-management/credit-card-fee-tax-entry",
		"cash-management/credit-card-txn",
		"cash-management/credit-card-txn-line",
		"cash-management/credit-card-txn-line-template",
		"cash-management/credit-card-txn-tax-entry",
		"cash-management/credit-card-txn-template",
		"cash-management/deposit",
		"cash-management/deposit-detail",
		"cash-management/deposit-line",
		"cash-management/financial-institution",
		"cash-management/funds-transfer",
		"cash-management/funds-transfer-line",
		"cash-management/journal-entry-line-template",
		"cash-management/journal-entry-template",
		"cash-management/other-receipt",
		"cash-management/other-receipt-line",
		"cash-management/other-receipt-tax-entry",
		"cash-management/payment-provider",
		"cash-management/payment-provider-bank-account",
		"cash-management/provider-payment-method",
		"cash-management/savings-account",
		"cash-management/undeposited-fund",
		"company-config/advanced-audit-history",
		"company-config/affiliate-entity",
		"company-config/affiliate-entity-group",
		"company-config/attachment",
		"company-config/audit-history",
		"company-config/class",
		"company-config/cloud-storage",
		"company-config/contact",
		"company-config/department",
		"company-config/department-group",
		"company-config/department-group-member",
		"company-config/document-sequence",
		"company-config/document-sequence-rollover",
		"company-config/earning-type",
		"company-config/email-delivery-record",
		"company-config/email-template",
		"company-config/employee",
		"company-config/employee-bank-file-setup",
		"company-config/employee-group",
		"company-config/employee-rate",
		"company-config/employee-type",
		"company-config/entity",
		"company-config/exchange-rate",
		"company-config/exchange-rate-line",
		"company-config/exchange-rate-type",
		"company-config/folder",
		"company-config/location",
		"company-config/location-group",
		"company-config/location-group-member",
		"company-config/permission",
		"company-config/role",
		"company-config/role-permission-assignment",
		"company-config/role-user-group-map",
		"company-config/role-user-map",
		"company-config/user",
		"company-config/user-group",
		"construction-forecasting/wip-forecast-detail",
		"construction-forecasting/wip-period",
		"construction-forecasting/wip-project",
		"construction-forecasting/wip-project-manager-forecast",
		"construction-forecasting/wip-setup",
		"construction-forecasting/wip-setup-account",
		"construction/accumulation-type",
		"construction/ap-releasable-retainage",
		"construction/ap-retainage-release",
		"construction/ap-retainage-release-line",
		"construction/ar-releasable-retainage",
		"construction/ar-retainage-release",
		"construction/ar-retainage-release-line",
		"construction/change-request",
		"construction/change-request-line",
		"construction/change-request-status",
		"construction/change-request-type",
		"construction/cost-type",
		"construction/cost-type-observed-percent-completed",
		"construction/employee-position",
		"construction/labor-class",
		"construction/labor-shift",
		"construction/labor-union",
		"construction/project-change-order",
		"construction/project-contract",
		"construction/project-contract-billing-invoice-detail",
		"construction/project-contract-billing-invoice-summary",
		"construction/project-contract-line",
		"construction/project-contract-line-entry",
		"construction/project-contract-type",
		"construction/project-estimate",
		"construction/project-estimate-line",
		"construction/project-estimate-type",
		"construction/rate-table",
		"construction/rate-table-accounts-payable-line",
		"construction/rate-table-credit-card-line",
		"construction/rate-table-employee-expense-line",
		"construction/rate-table-journal-line",
		"construction/rate-table-purchasing-line",
		"construction/rate-table-timesheet-line",
		"construction/standard-cost-type",
		"construction/standard-task",
		"contracts/billing-price-list",
		"contracts/billing-price-list-entry",
		"contracts/billing-price-list-entry-line",
		"contracts/billing-price-list-entry-line-tier",
		"contracts/billing-schedule",
		"contracts/billing-schedule-line",
		"contracts/billing-template",
		"contracts/billing-template-line",
		"contracts/contract",
		"contracts/contract-line",
		"contracts/contract-type",
		"contracts/contract-usage",
		"contracts/expense-template",
		"contracts/expense-template-line",
		"contracts/mea-category",
		"contracts/mea-price-list",
		"contracts/mea-price-list-entry",
		"contracts/mea-price-list-entry-line",
		"contracts/revenue-schedule",
		"contracts/revenue-schedule-line",
		"contracts/revenue-template",
		"core/user-view",
		"expenses/electronic-receipt",
		"expenses/electronic-receipt-line",
		"expenses/employee-expense",
		"expenses/employee-expense-adjustment",
		"expenses/employee-expense-adjustment-line",
		"expenses/employee-expense-line",
		"expenses/employee-expense-payment-type",
		"expenses/employee-expense-summary",
		"expenses/employee-expense-type",
		"expenses/expense-to-approve",
		"expenses/expense-to-approve-line",
		"expenses/unit-rate",
		"fixed-assets/asset",
		"fixed-assets/asset-classification",
		"fixed-assets/asset-depreciation-rule",
		"fixed-assets/classification-depreciation-rule",
		"fixed-assets/depreciation-method",
		"fixed-assets/depreciation-schedule",
		"fixed-assets/depreciation-schedule-entry",
		"fixed-assets/setup",
		"fixed-assets/setup-posting-rule",
		"fixed-assets/transfer-history",
		"fixed-assets/transfer-journal-entry-map",
		"general-ledger/account",
		"general-ledger/account-allocation",
		"general-ledger/account-allocation-basis",
		"general-ledger/account-allocation-group",
		"general-ledger/account-allocation-group-member",
		"general-ledger/account-allocation-reverse",
		"general-ledger/account-allocation-run",
		"general-ledger/account-allocation-source",
		"general-ledger/account-allocation-target",
		"general-ledger/account-category",
		"general-ledger/account-group",
		"general-ledger/account-group-category-member",
		"general-ledger/account-group-computation",
		"general-ledger/account-group-member",
		"general-ledger/account-group-purpose",
		"general-ledger/account-range",
		"general-ledger/budget",
		"general-ledger/budget-detail",
		"general-ledger/journal",
		"general-ledger/journal-entry",
		"general-ledger/journal-entry-line",
		"general-ledger/journal-entry-tax-entry",
		"general-ledger/reporting-period",
		"general-ledger/statistical-account",
		"general-ledger/statistical-adjustment-journal",
		"general-ledger/statistical-journal",
		"general-ledger/statistical-journal-entry",
		"general-ledger/statistical-journal-entry-line",
		"general-ledger/txn-allocation-template",
		"general-ledger/txn-allocation-template-line",
		"inventory-control/aisle",
		"inventory-control/bin",
		"inventory-control/bin-face",
		"inventory-control/bin-size",
		"inventory-control/cycle",
		"inventory-control/document",
		"inventory-control/document-history",
		"inventory-control/document-line",
		"inventory-control/document-line-detail",
		"inventory-control/document-subtotal",
		"inventory-control/item",
		"inventory-control/item-cross-reference",
		"inventory-control/item-gl-group",
		"inventory-control/item-group",
		"inventory-control/item-group-member",
		"inventory-control/item-landed-cost",
		"inventory-control/item-vendor",
		"inventory-control/item-warehouse-inventory",
		"inventory-control/item-warehouse-standard-cost",
		"inventory-control/item-warehouse-vendor",
		"inventory-control/kit-component",
		"inventory-control/posting-summary",
		"inventory-control/price-list",
		"inventory-control/price-list-entry",
		"inventory-control/product-line",
		"inventory-control/row",
		"inventory-control/stockable-kit-document",
		"inventory-control/stockable-kit-document-line",
		"inventory-control/total",
		"inventory-control/txn-definition",
		"inventory-control/txn-definition-cogs-gl-detail",
		"inventory-control/txn-definition-entity-detail",
		"inventory-control/txn-definition-source",
		"inventory-control/txn-definition-subtotal-detail",
		"inventory-control/txn-definition-total-detail",
		"inventory-control/unit-of-measure",
		"inventory-control/unit-of-measure-group",
		"inventory-control/warehouse",
		"inventory-control/warehouse-transfer",
		"inventory-control/warehouse-transfer-line",
		"inventory-control/zone",
		"order-entry/document",
		"order-entry/document-history",
		"order-entry/document-line",
		"order-entry/document-line-detail",
		"order-entry/document-line-subtotal",
		"order-entry/document-subtotal",
		"order-entry/price-list",
		"order-entry/price-list-entry",
		"order-entry/price-schedule",
		"order-entry/recurring-document",
		"order-entry/recurring-document-line",
		"order-entry/recurring-document-subtotal",
		"order-entry/recurring-schedule",
		"order-entry/renewal-template",
		"order-entry/subtotal-template",
		"order-entry/subtotal-template-line",
		"order-entry/txn-definition",
		"order-entry/txn-definition-additional-gl-detail",
		"order-entry/txn-definition-ar-direct-gl-detail",
		"order-entry/txn-definition-cogs-gl-detail",
		"order-entry/txn-definition-entity-setting-detail",
		"order-entry/txn-definition-inventory-total-detail",
		"order-entry/txn-definition-source-document-detail",
		"order-entry/txn-definition-subtotal-detail",
		"projects/position-skill",
		"projects/project",
		"projects/project-group",
		"projects/project-resource",
		"projects/project-status",
		"projects/project-type",
		"projects/task",
		"purchasing-txn-definition-entity-setting-detail",
		"purchasing-txn-definition-inventory-total-detail",
		"purchasing-txn-definition-source-document-detail",
		"purchasing-txn-definition-subtotal-detail",
		"purchasing/document",
		"purchasing/document-history",
		"purchasing/document-line",
		"purchasing/document-line-detail",
		"purchasing/document-line-subtotal",
		"purchasing/document-subtotal",
		"purchasing/price-list",
		"purchasing/price-list-entry",
		"purchasing/price-schedule",
		"purchasing/recurring-document",
		"purchasing/recurring-document-line",
		"purchasing/recurring-document-subtotal",
		"purchasing/secondary-vendor",
		"purchasing/subtotal-template",
		"purchasing/subtotal-template-line",
		"purchasing/txn-definition",
		"purchasing/txn-definition-additional-gl-detail",
		"purchasing/txn-definition-ap-direct-gl-detail",
		"purchasing/vendor-gl-group",
		"tax/account-label-tax-group",
		"tax/contact-tax-group",
		"tax/item-tax-group",
		"tax/item-tax-group-item-map",
		"tax/order-entry-tax-detail",
		"tax/order-entry-tax-schedule",
		"tax/order-entry-tax-schedule-detail",
		"tax/purchasing-tax-detail",
		"tax/purchasing-tax-schedule",
		"tax/purchasing-tax-schedule-detail",
		"tax/tax-authority",
		"tax/tax-detail",
		"tax/tax-record",
		"tax/tax-return",
		"tax/tax-solution",
		"time/time-type",
		"time/timesheet",
		"time/timesheet-approval-record",
		"time/timesheet-line",
		"time/timesheet-rule",
		"time/timesheet-to-approve",
	}

	return components.EndpointRegistryInput{
		common.ModuleRoot: {
			{
				Endpoint: fmt.Sprintf("{%s}", strings.Join(readWriteSupport, ",")),
				Support:  components.ReadSupport,
			},
			{
				Endpoint: fmt.Sprintf("{%s}", strings.Join(readWriteSupport, ",")),
				Support:  components.WriteSupport,
			},
		},
	}
}
