package main

import (
	"fmt"
	"log"
)

func main() {
	// Default containerd socket path
	socketPath := "/run/containerd/containerd.sock"
	// Default namespace for Docker with containerd
	namespace := "moby"

	// Create the image manager
	imgManager, err := NewImageManager(socketPath, namespace)
	if err != nil {
		log.Fatalf("Failed to create image manager: %v", err)
	}

	img := "docker.io/library/alpine:3.20.3"
	err = imgManager.Pull(img)
	if err != nil {
		panic(err)
	}

	imgs, err := imgManager.List()
	if err != nil {
		panic(err)
	}
	fmt.Printf("Images: %v\n", imgs)

	err = imgManager.Pin(img)
	if err != nil {
		panic(err)
	}
	imgs, err = imgManager.List()
	if err != nil {
		panic(err)
	}
	fmt.Printf("Images: %v\n", imgs)

	err = imgManager.Unpin(img)
	if err != nil {
		panic(err)
	}

	imgs, err = imgManager.List()
	if err != nil {
		panic(err)
	}
	fmt.Printf("Images: %v\n", imgs)

}
