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

// ==================== LABOR MUTATIONS ====================

export const CREATE_LABOR = gql`
	mutation CreateLabor($accountAddressId: UUID!, $input: CreateLaborInput!) {
		createLabor(accountAddressId: $accountAddressId, input: $input) {
			id
			amount
			startDate
			endDate
			isActive
		}
	}
`;

export const UPDATE_LABOR = gql`
	mutation UpdateLabor($id: UUID!, $input: UpdateLaborInput!) {
		updateLabor(id: $id, input: $input) {
			id
			amount
			startDate
			endDate
			isActive
		}
	}
`;

export const DELETE_LABOR = gql`
	mutation DeleteLabor($id: UUID!) {
		deleteLabor(id: $id)
	}
`;

// ==================== SCHEDULE MUTATIONS ====================

export const CREATE_SCHEDULE = gql`
	mutation CreateSchedule($accountAddressId: UUID!, $input: CreateScheduleInput!) {
		createSchedule(accountAddressId: $accountAddressId, input: $input) {
			id
			name
			monday
			tuesday
			wednesday
			thursday
			friday
			saturday
			sunday
			weekendService
			scheduleException
			startDate
			endDate
			isActive
		}
	}
`;

export const UPDATE_SCHEDULE = gql`
	mutation UpdateSchedule($id: UUID!, $input: UpdateScheduleInput!) {
		updateSchedule(id: $id, input: $input) {
			id
			name
			monday
			tuesday
			wednesday
			thursday
			friday
			saturday
			sunday
			weekendService
			scheduleException
			startDate
			endDate
			isActive
		}
	}
`;

export const DELETE_SCHEDULE = gql`
	mutation DeleteSchedule($id: UUID!) {
		deleteSchedule(id: $id)
	}
`;

// ==================== SERVICE SCOPE MUTATIONS ====================

export const CREATE_SERVICE_SCOPE = gql`
	mutation CreateServiceScope(
		$accountId: UUID!
		$accountAddressId: UUID!
		$input: CreateServiceScopeInput!
	) {
		createServiceScope(accountId: $accountId, accountAddressId: $accountAddressId, input: $input) {
			id
			name
			description
			isActive
		}
	}
`;

export const UPDATE_SERVICE_SCOPE = gql`
	mutation UpdateServiceScope($id: UUID!, $input: UpdateServiceScopeInput!) {
		updateServiceScope(id: $id, input: $input) {
			id
			name
			description
			isActive
		}
	}
`;

export const DELETE_SERVICE_SCOPE = gql`
	mutation DeleteServiceScope($id: UUID!) {
		deleteServiceScope(id: $id)
	}
`;

// ==================== SCOPE AREA MUTATIONS ====================

export const CREATE_SCOPE_AREA = gql`
	mutation CreateScopeArea($scopeId: UUID!, $input: CreateScopeAreaInput!) {
		createScopeArea(scopeId: $scopeId, input: $input) {
			id
			name
			order
		}
	}
`;

export const UPDATE_SCOPE_AREA = gql`
	mutation UpdateScopeArea($id: UUID!, $input: UpdateScopeAreaInput!) {
		updateScopeArea(id: $id, input: $input) {
			id
			name
			order
		}
	}
`;

export const DELETE_SCOPE_AREA = gql`
	mutation DeleteScopeArea($id: UUID!) {
		deleteScopeArea(id: $id)
	}
`;

// ==================== SCOPE TASK MUTATIONS ====================

export const CREATE_SCOPE_TASK = gql`
	mutation CreateScopeTask($areaId: UUID!, $input: CreateScopeTaskInput!) {
		createScopeTask(areaId: $areaId, input: $input) {
			id
			scopeDescription
			checklistDescription
			sessionDescription
			frequency
			order
			estimatedMinutes
		}
	}
`;

export const UPDATE_SCOPE_TASK = gql`
	mutation UpdateScopeTask($id: UUID!, $input: UpdateScopeTaskInput!) {
		updateScopeTask(id: $id, input: $input) {
			id
			scopeDescription
			checklistDescription
			sessionDescription
			frequency
			order
			estimatedMinutes
		}
	}
`;

export const DELETE_SCOPE_TASK = gql`
	mutation DeleteScopeTask($id: UUID!) {
		deleteScopeTask(id: $id)
	}
`;

// ==================== ACCOUNT ADDRESS (LOCATION) MUTATIONS ====================

export const UPDATE_ACCOUNT_ADDRESS = gql`
	mutation UpdateAccountAddress($id: UUID!, $input: UpdateAccountAddressInput!) {
		updateAccountAddress(id: $id, input: $input) {
			id
			name
			streetAddress
			city
			state
			zipCode
			notes
			isPrimary
			isActive
		}
	}
`;
