package ca_certificates

import (
	"path"
	"path/filepath"

	"github.com/google/blueprint/proptools"

	"android/soong/android"
	"android/soong/etc"
	"android/soong/phony"
)

func init() {
	android.RegisterModuleType("ca_certificates", caCertificatesFactory)
	android.RegisterModuleType("ca_certificates_host", caCertificatesHostFactory)
}

type caCertificatesProperties struct {
	Src_dir            *string
	Dest_dir           *string
	Module_name_prefix *string
}

func caCertificatesLoadHook(
	ctx android.LoadHookContext, factory android.ModuleFactory, c *caCertificatesProperties) {
	// Find all files in src_dir.
	srcs, err := ctx.GlobWithDeps(path.Join(ctx.ModuleDir(), *c.Src_dir, "*"), nil)
	if err != nil || len(srcs) == 0 {
		ctx.PropertyErrorf("src_dir", "cannot find files to install")
		return
	}

	// Scan through the found files to create a prebuilt_etc module for each of them.
	requiredModuleNames := make([]string, len(srcs))
	for i, src := range srcs {
		etcProps := struct {
			Name     *string
			Src      *string
			Sub_dir  *string
			Filename *string
		}{}
		filename := filepath.Base(src)
		moduleName := *c.Module_name_prefix + filename
		etcProps.Name = proptools.StringPtr(moduleName)
		etcProps.Src = proptools.StringPtr(path.Join(*c.Src_dir, filename))
		etcProps.Sub_dir = c.Dest_dir
		etcProps.Filename = proptools.StringPtr(filename)
		ctx.CreateModule(factory, &etcProps)

		// Add it to the required module list of the parent phony rule.
		requiredModuleNames[i] = moduleName
	}

	phonyProps := struct {
		Required []string
	}{}
	phonyProps.Required = requiredModuleNames
	ctx.AppendProperties(&phonyProps)
}

func caCertificatesFactory() android.Module {
	p := phony.PhonyFactory()
	c := &caCertificatesProperties{}
	android.AddLoadHook(p, func(ctx android.LoadHookContext) {
		caCertificatesLoadHook(ctx, etc.PrebuiltEtcFactory, c)
	})
	p.AddProperties(c)

	return p
}

func caCertificatesHostFactory() android.Module {
	p := phony.PhonyFactory()
	c := &caCertificatesProperties{}
	android.AddLoadHook(p, func(ctx android.LoadHookContext) {
		caCertificatesLoadHook(ctx, etc.PrebuiltEtcHostFactory, c)
	})
	p.AddProperties(c)

	return p
}
