import { resolveBusinessContext, pageUrl, businessPageRoot } from './context.js';

export default {
	inject: {
		businessContext: { default: null },
	},
	computed: {
		bizCtx() {
			return resolveBusinessContext(this.businessContext);
		},
		bizApi() {
			return this.bizCtx.api;
		},
		bizCap() {
			return this.bizCtx.capabilities || {};
		},
		bizRoot() {
			return businessPageRoot(this.bizCtx);
		},
	},
	methods: {
		bizPage(subPath) {
			return pageUrl(this.bizCtx, subPath);
		},
	},
};
