import { gql } from '@apollo/client/core';
import type { TeamRole, EntityStatus } from '../queries/team';

// ==================== TEAM PROFILE MUTATIONS ====================

export const CREATE_TEAM_PROFILE = gql`
	mutation CreateTeamProfile($input: CreateTeamProfileInput!) {
		createTeamProfile(input: $input) {
			id
			firstName
			lastName
			fullName
			email
			phone
			role
			status
			notes
			createdAt
			updatedAt
		}
	}
`;

export const UPDATE_TEAM_PROFILE = gql`
	mutation UpdateTeamProfile($id: UUID!, $input: UpdateTeamProfileInput!) {
		updateTeamProfile(id: $id, input: $input) {
			id
			firstName
			lastName
			fullName
			email
			phone
			role
			status
			notes
			createdAt
			updatedAt
		}
	}
`;

export const DELETE_TEAM_PROFILE = gql`
	mutation DeleteTeamProfile($id: UUID!) {
		deleteTeamProfile(id: $id)
	}
`;

// ==================== CUSTOMER PROFILE MUTATIONS ====================

export const CREATE_CUSTOMER_PROFILE = gql`
	mutation CreateCustomerProfile($input: CreateCustomerProfileInput!) {
		createCustomerProfile(input: $input) {
			id
			firstName
			lastName
			fullName
			email
			phone
			status
			notes
			createdAt
			updatedAt
		}
	}
`;

export const UPDATE_CUSTOMER_PROFILE = gql`
	mutation UpdateCustomerProfile($id: UUID!, $input: UpdateCustomerProfileInput!) {
		updateCustomerProfile(id: $id, input: $input) {
			id
			firstName
			lastName
			fullName
			email
			phone
			status
			notes
			createdAt
			updatedAt
		}
	}
`;

export const DELETE_CUSTOMER_PROFILE = gql`
	mutation DeleteCustomerProfile($id: UUID!) {
		deleteCustomerProfile(id: $id)
	}
`;

// ==================== INPUT TYPES ====================

export interface CreateTeamProfileInput {
	kratosIdentityId: string;
	firstName: string;
	lastName: string;
	email: string;
	phone: string;
	role: TeamRole;
	status?: EntityStatus;
	notes: string;
}

export interface UpdateTeamProfileInput {
	firstName?: string;
	lastName?: string;
	email?: string;
	phone?: string;
	role?: TeamRole;
	status?: EntityStatus;
	notes?: string;
}

export interface CreateCustomerProfileInput {
	kratosIdentityId: string;
	firstName: string;
	lastName: string;
	email: string;
	phone: string;
	status?: EntityStatus;
	notes: string;
}

export interface UpdateCustomerProfileInput {
	firstName?: string;
	lastName?: string;
	email?: string;
	phone?: string;
	status?: EntityStatus;
	notes?: string;
}
