// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package builder

import (
	"github.com/luxfi/runtime"
	"github.com/luxfi/constants"
	"github.com/luxfi/ids"
	"github.com/luxfi/node/vms/components/gas"
	"github.com/luxfi/node/vms/platformvm/txs/fee"
)

const Alias = "P"

type Context struct {
	NetworkID         uint32
	ChainID           ids.ID // Optional: if set, overrides default PlatformChainID
	UTXOAssetID          ids.ID
	ComplexityWeights gas.Dimensions
	GasPrice          gas.Price
	StaticFeeConfig   fee.StaticConfig
}

func NewConsensusRuntime(networkID uint32, utxoAssetID ids.ID) (*runtime.Runtime, error) {
	return NewConsensusRuntimeWithChainID(networkID, constants.PlatformChainID, utxoAssetID)
}

func NewConsensusRuntimeWithChainID(networkID uint32, chainID ids.ID, utxoAssetID ids.ID) (*runtime.Runtime, error) {
	lookup := ids.NewAliaser()
	rt := &runtime.Runtime{
		NetworkID: networkID,
		ChainID:   chainID,
		UTXOAssetID:  utxoAssetID,
	}
	return rt, lookup.Alias(chainID, Alias)
}
