import { gql } from '@apollo/client/core';

export const CREATE_REPORT = gql`
	mutation CreateReport($input: CreateReportInput!) {
		createReport(input: $input) {
			id
			teamProfileId
			startDate
			endDate
			status
		}
	}
`;

export const UPDATE_REPORT = gql`
	mutation UpdateReport($id: UUID!, $input: UpdateReportInput!) {
		updateReport(id: $id, input: $input) {
			id
			teamProfileId
			startDate
			endDate
			status
		}
	}
`;

export const DELETE_REPORT = gql`
	mutation DeleteReport($id: UUID!) {
		deleteReport(id: $id)
	}
`;

export const ADD_SERVICE_TO_REPORT = gql`
	mutation AddServiceToReport($reportId: UUID!, $serviceId: UUID!) {
		addServiceToReport(reportId: $reportId, serviceId: $serviceId) {
			id
			reportId
			serviceId
			laborShare
		}
	}
`;

export const ADD_PROJECT_TO_REPORT = gql`
	mutation AddProjectToReport($reportId: UUID!, $projectId: UUID!) {
		addProjectToReport(reportId: $reportId, projectId: $projectId) {
			id
			reportId
			projectId
			laborShare
		}
	}
`;

export const REMOVE_SERVICE_FROM_REPORT = gql`
	mutation RemoveServiceFromReport($id: UUID!) {
		removeServiceFromReport(id: $id)
	}
`;

export const REMOVE_PROJECT_FROM_REPORT = gql`
	mutation RemoveProjectFromReport($id: UUID!) {
		removeProjectFromReport(id: $id)
	}
`;

export const ADD_ALL_ELIGIBLE_SERVICES = gql`
	mutation AddAllEligibleServicesToReport($reportId: UUID!) {
		addAllEligibleServicesToReport(reportId: $reportId)
	}
`;

export const ADD_ALL_ELIGIBLE_PROJECTS = gql`
	mutation AddAllEligibleProjectsToReport($reportId: UUID!) {
		addAllEligibleProjectsToReport(reportId: $reportId)
	}
`;

// Input types for mutations
export interface CreateReportInput {
	teamProfileId: string;
	startDate: string;
	endDate: string;
}

export interface UpdateReportInput {
	startDate?: string;
	endDate?: string;
	status?: 'DRAFT' | 'FINALIZED' | 'PAID';
}
