package helicopterfile

import (
	"context"

	filemanager "wucher/internal/domain/file_manager"
)

type BulkItemError struct {
	Status int
	Title  string
	Detail string
}

type UploadIntentBulkInput struct {
	Type        string
	Name        string
	ContentType string
	SizeBytes   int64
}

type UploadIntentBulkItemResult struct {
	Index   int
	Success bool
	Grant   *filemanager.FileUploadIntentGrant
	Error   *BulkItemError
}

type CreateBulkInput struct {
	Type             string
	Section          string
	Position         *int
	IsMandatory      *bool
	HelicopterID     string
	UploadIntentUUID string
	FileName         string
	FolderUUID       *string
}

type CreateBulkItemResult struct {
	Index   int
	Success bool
	Row     *HelicopterFile
	Error   *BulkItemError
}

type Service interface {
	Create(ctx context.Context, row *HelicopterFile) error
	Update(ctx context.Context, row *HelicopterFile) error
	Delete(ctx context.Context, id []byte) error
	GetByID(ctx context.Context, id []byte) (*HelicopterFile, error)
	List(ctx context.Context, filter string, sort string, limit, offset int) ([]HelicopterFile, int64, error)
	ListByHelicopter(ctx context.Context, helicopterID []byte) ([]HelicopterFile, error)
	ListByHelicopterAndSection(ctx context.Context, helicopterID []byte, section string) ([]HelicopterFile, error)
	HelicopterExists(ctx context.Context, helicopterID []byte) (bool, error)
	AttachmentExists(ctx context.Context, attachmentID []byte) (bool, error)
	RequestUploadIntentsBulk(ctx context.Context, inputs []UploadIntentBulkInput, actorID []byte) []UploadIntentBulkItemResult
	CreateFromUploadIntentsBulk(ctx context.Context, inputs []CreateBulkInput, actorID []byte) []CreateBulkItemResult
}
