package processor

import (
	"apskel-pos-be/internal/entities"
	"context"

	"github.com/google/uuid"
)

type PurchaseOrderRepository interface {
	Create(ctx context.Context, po *entities.PurchaseOrder) error
	GetByID(ctx context.Context, id uuid.UUID) (*entities.PurchaseOrder, error)
	GetByIDAndOrganizationID(ctx context.Context, id, organizationID uuid.UUID) (*entities.PurchaseOrder, error)
	Update(ctx context.Context, po *entities.PurchaseOrder) error
	Delete(ctx context.Context, id uuid.UUID) error
	List(ctx context.Context, organizationID uuid.UUID, filters map[string]interface{}, limit, offset int) ([]*entities.PurchaseOrder, int64, error)
	Count(ctx context.Context, organizationID uuid.UUID, filters map[string]interface{}) (int64, error)
	GetByPONumber(ctx context.Context, poNumber string, organizationID uuid.UUID) (*entities.PurchaseOrder, error)
	GetByStatus(ctx context.Context, organizationID uuid.UUID, status string) ([]*entities.PurchaseOrder, error)
	GetOverdue(ctx context.Context, organizationID uuid.UUID) ([]*entities.PurchaseOrder, error)
	UpdateStatus(ctx context.Context, id uuid.UUID, status string) error
	UpdateTotalAmount(ctx context.Context, id uuid.UUID, totalAmount float64) error
	CreateItem(ctx context.Context, item *entities.PurchaseOrderItem) error
	UpdateItem(ctx context.Context, item *entities.PurchaseOrderItem) error
	DeleteItem(ctx context.Context, id uuid.UUID) error
	DeleteItemsByPurchaseOrderID(ctx context.Context, purchaseOrderID uuid.UUID) error
	GetItemsByPurchaseOrderID(ctx context.Context, purchaseOrderID uuid.UUID) ([]*entities.PurchaseOrderItem, error)
	CreateAttachment(ctx context.Context, attachment *entities.PurchaseOrderAttachment) error
	DeleteAttachment(ctx context.Context, id uuid.UUID) error
	DeleteAttachmentsByPurchaseOrderID(ctx context.Context, purchaseOrderID uuid.UUID) error
	GetAttachmentsByPurchaseOrderID(ctx context.Context, purchaseOrderID uuid.UUID) ([]*entities.PurchaseOrderAttachment, error)
}
