import { PAYMENT_METHODS } from "./Payments.model";

export type FindClientAccountMovementsParams = {
	id?: string;
	clientId: string;
	type?: CLIENT_ACCOUNT_MOVEMENT_TYPES;
	status?: CLIENT_ACCOUNT_MOVEMENT_STATUS;
	reference?: string;
	startDate?: Date;
	endDate?: Date;
	sessionUser: string;
	method?: PAYMENT_METHODS;
};

export type PaginateClientAccountMovementsParams =
	FindClientAccountMovementsParams & {
		page: number;
		limit: number;
	};

export type PaginateClientAccountMovementsResults = {
	data: IClientAccountMovement[];
	page: number;
	pages: number;
};

export type CreateClientAccountMovementParams = {
	clientId: string;
	amount: number;
	description?: string;
	type: CLIENT_ACCOUNT_MOVEMENT_TYPES;
	reference?: string;
	status: CLIENT_ACCOUNT_MOVEMENT_STATUS;
	paymentMethod: CLIENT_ACCOUNT_PAYMENT_METHODS;
	notification?: boolean;
	sessionUser: string;
};

export type DeleteClientAccountMovementParams = {
	movementId: string;
	sessionUser: string;
};

export type CalculateClientAccountBalanceParams = {
	clientId: string;
	sessionUser: string;
};

export enum CLIENT_ACCOUNT_MOVEMENT_TYPES {
	DEPOSIT = "deposit",
	WITHDRAWAL = "withdrawal",
}

export enum CLIENT_ACCOUNT_MOVEMENT_STATUS {
	PENDING = "pending",
	APPROVED = "approved",
	REJECTED = "rejected",
}

export enum CLIENT_ACCOUNT_PAYMENT_METHODS {
	CASH = "cash",
	BANK_TRANSFER = "bank_transfer",
	CREDIT_CARD = "credit_card",
	DEBIT_CARD = "debit_card",
	OTHER = "other",
}

export interface IClientAccountMovement {
	id: string;
	clientId: string;
	amount: number;
	description: string;
	type: CLIENT_ACCOUNT_MOVEMENT_TYPES;
	reference: string;
	status: CLIENT_ACCOUNT_MOVEMENT_STATUS;
	paymentMethod: CLIENT_ACCOUNT_PAYMENT_METHODS;
	createdAt: Date;
	updatedAt: Date;
}
