import { vscode } from './message';
import { MergeRequestState } from './types';

export function getState(): MergeRequestState {
	return vscode.getState();
}

export function setState(mergeRequest: MergeRequestState): void {
	if (mergeRequest) {
		vscode.setState(mergeRequest);
	}
}

export function updateState(data: Partial<MergeRequestState>): void {
	const pullRequest = vscode.getState();
	vscode.setState(Object.assign(pullRequest, data));
}
