package repository

import (
	"context"
	"pki-manager/internal/models"
)

type Repository interface {
	// CA operations
	CreateCA(ctx context.Context, ca *models.CA) error
	GetCA(ctx context.Context, id string) (*models.CA, error)
	GetAllCAs(ctx context.Context) ([]*models.CA, error)
	UpdateCA(ctx context.Context, id string, updates map[string]interface{}) error
	DeleteCA(ctx context.Context, id string) error

	// SubCA operations
	CreateSubCA(ctx context.Context, subca *models.SubCA) error
	GetSubCA(ctx context.Context, id string) (*models.SubCA, error)
	GetSubCAsByParent(ctx context.Context, parentCAID string) ([]*models.SubCA, error)
	GetAllSubCAs(ctx context.Context) ([]*models.SubCA, error)
	UpdateSubCA(ctx context.Context, id string, updates map[string]interface{}) error
	DeleteSubCA(ctx context.Context, id string) error

	// Certificate operations
	CreateCertificate(ctx context.Context, cert *models.Certificate) error
	GetCertificate(ctx context.Context, id string) (*models.Certificate, error)
	GetCertificatesByIssuer(ctx context.Context, issuerCAID string) ([]*models.Certificate, error)
	GetAllCertificates(ctx context.Context) ([]*models.Certificate, error)
	UpdateCertificate(ctx context.Context, id string, updates map[string]interface{}) error
	DeleteCertificate(ctx context.Context, id string) error
	RevokeCertificate(ctx context.Context, id string, reason string) error
}
