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

export const PROJECT_SCOPE_TEMPLATES_QUERY = gql`
	query ProjectScopeTemplates($isActive: Boolean) {
		projectScopeTemplates(isActive: $isActive) {
			id
			name
			description
			isActive
			categoryCount
			taskCount
		}
	}
`;

export const PROJECT_SCOPE_TEMPLATE_QUERY = gql`
	query ProjectScopeTemplate($id: UUID!) {
		projectScopeTemplate(id: $id) {
			id
			name
			description
			isActive
			categories {
				id
				templateId
				name
				order
				taskCount
				tasks {
					id
					categoryId
					scopeDescription
					checklistDescription
					sessionDescription
					order
					estimatedMinutes
				}
			}
		}
	}
`;

export interface ProjectScopeTemplateListItem {
	id: string;
	name: string;
	description: string | null;
	isActive: boolean;
	categoryCount: number;
	taskCount: number;
}

export interface ProjectScopeTemplateTask {
	id: string;
	categoryId: string;
	scopeDescription: string;
	checklistDescription: string;
	sessionDescription: string;
	order: number;
	estimatedMinutes: number | null;
}

export interface ProjectScopeTemplateCategory {
	id: string;
	templateId: string;
	name: string;
	order: number;
	taskCount: number;
	tasks: ProjectScopeTemplateTask[];
}

export interface ProjectScopeTemplate {
	id: string;
	name: string;
	description: string | null;
	isActive: boolean;
	categories: ProjectScopeTemplateCategory[];
}

export interface ProjectScopeTemplatesQueryResult {
	projectScopeTemplates: ProjectScopeTemplateListItem[];
}

export interface ProjectScopeTemplateQueryResult {
	projectScopeTemplate: ProjectScopeTemplate | null;
}
