

const require_array = require('../../../utils/array.js');
require('../../../utils/index.js');
const require_VerificationMethod = require('./verificationMethod/VerificationMethod.js');
require('./verificationMethod/index.js');
const require_DidDocument = require('./DidDocument.js');

//#region src/modules/dids/domain/DidDocumentBuilder.ts
var DidDocumentBuilder = class {
	constructor(id) {
		this.didDocument = new require_DidDocument.DidDocument({ id });
	}
	addContext(context) {
		const currentContexts = require_array.asArray(this.didDocument.context);
		if (currentContexts.includes(context)) return this;
		this.didDocument.context = [...currentContexts, context];
		return this;
	}
	addController(controller) {
		const currentControllers = require_array.asArray(this.didDocument.controller);
		if (currentControllers.includes(controller)) return this;
		this.didDocument.controller = [...currentControllers, controller];
		return this;
	}
	addService(service) {
		if (!this.didDocument.service) this.didDocument.service = [];
		this.didDocument.service.push(service);
		return this;
	}
	addVerificationMethod(verificationMethod) {
		if (!this.didDocument.verificationMethod) this.didDocument.verificationMethod = [];
		this.didDocument.verificationMethod.push(verificationMethod instanceof require_VerificationMethod.VerificationMethod ? verificationMethod : new require_VerificationMethod.VerificationMethod(verificationMethod));
		return this;
	}
	addAuthentication(authentication) {
		if (!this.didDocument.authentication) this.didDocument.authentication = [];
		const verificationMethod = authentication instanceof require_VerificationMethod.VerificationMethod || typeof authentication === "string" ? authentication : new require_VerificationMethod.VerificationMethod(authentication);
		this.didDocument.authentication.push(verificationMethod);
		return this;
	}
	addAssertionMethod(assertionMethod) {
		if (!this.didDocument.assertionMethod) this.didDocument.assertionMethod = [];
		const verificationMethod = assertionMethod instanceof require_VerificationMethod.VerificationMethod || typeof assertionMethod === "string" ? assertionMethod : new require_VerificationMethod.VerificationMethod(assertionMethod);
		this.didDocument.assertionMethod.push(verificationMethod);
		return this;
	}
	addCapabilityDelegation(capabilityDelegation) {
		if (!this.didDocument.capabilityDelegation) this.didDocument.capabilityDelegation = [];
		const verificationMethod = capabilityDelegation instanceof require_VerificationMethod.VerificationMethod || typeof capabilityDelegation === "string" ? capabilityDelegation : new require_VerificationMethod.VerificationMethod(capabilityDelegation);
		this.didDocument.capabilityDelegation.push(verificationMethod);
		return this;
	}
	addCapabilityInvocation(capabilityInvocation) {
		if (!this.didDocument.capabilityInvocation) this.didDocument.capabilityInvocation = [];
		const verificationMethod = capabilityInvocation instanceof require_VerificationMethod.VerificationMethod || typeof capabilityInvocation === "string" ? capabilityInvocation : new require_VerificationMethod.VerificationMethod(capabilityInvocation);
		this.didDocument.capabilityInvocation.push(verificationMethod);
		return this;
	}
	addKeyAgreement(keyAgreement) {
		if (!this.didDocument.keyAgreement) this.didDocument.keyAgreement = [];
		const verificationMethod = keyAgreement instanceof require_VerificationMethod.VerificationMethod || typeof keyAgreement === "string" ? keyAgreement : new require_VerificationMethod.VerificationMethod(keyAgreement);
		this.didDocument.keyAgreement.push(verificationMethod);
		return this;
	}
	build() {
		return this.didDocument;
	}
};

//#endregion
exports.DidDocumentBuilder = DidDocumentBuilder;