package prepo

import (
	ri "github.com/tech/sendico/pkg/db/repository/index"
)

type indexDefinition = ri.Definition

func requiredIndexes() []*indexDefinition {
	return []*indexDefinition{
		{
			Keys: []ri.Key{
				{Field: "organizationRef", Sort: ri.Asc},
				{Field: "paymentRef", Sort: ri.Asc},
			},
			Unique: true,
		},
		{
			Keys: []ri.Key{
				{Field: "paymentRef", Sort: ri.Asc},
			},
			Unique: true,
		},
		{
			Keys: []ri.Key{
				{Field: "organizationRef", Sort: ri.Asc},
				{Field: "idempotencyKey", Sort: ri.Asc},
			},
			Unique: true,
		},
		{
			Keys: []ri.Key{
				{Field: "organizationRef", Sort: ri.Asc},
				{Field: "quotationRef", Sort: ri.Asc},
				{Field: "createdAt", Sort: ri.Desc},
			},
		},
		{
			Keys: []ri.Key{
				{Field: "organizationRef", Sort: ri.Asc},
				{Field: "state", Sort: ri.Asc},
				{Field: "createdAt", Sort: ri.Desc},
			},
		},
		{
			Keys: []ri.Key{
				{Field: "state", Sort: ri.Asc},
				{Field: "createdAt", Sort: ri.Desc},
			},
		},
	}
}
