Files
webMontime/src/api/types.ts
T
2026-07-16 13:34:02 +03:30

188 lines
4.2 KiB
TypeScript

export type BookingStatus =
| 'pending'
| 'awaiting_payment'
| 'confirmed'
| 'cancelled'
| 'completed';
export type BusinessCategory = {
id: string;
slug: string;
title: string;
isActive: boolean;
};
export type BusinessImage = {
id: string;
url: string;
originalName?: string | null;
sortOrder: number;
isCover: boolean;
};
export type Business = {
id: string;
title: string;
subtitle?: string | null;
slug: string;
description?: string | null;
address?: string | null;
contactPhone?: string | null;
phone?: string | null;
isActive: boolean;
categoryId: string;
category?: BusinessCategory;
images?: BusinessImage[];
concurrentCapacity?: number;
slotStepMinutes?: number;
serviceClassesEnabled?: boolean;
autoApproveBookings?: boolean;
tipsEnabled?: boolean;
promoDiscountEnabled?: boolean;
promoDiscountTitle?: string | null;
promoDiscountPercent?: number | null;
promoDiscountCode?: string | null;
promoDiscountMode?: 'first_booking' | 'always';
logoLightUrl?: string | null;
logoDarkUrl?: string | null;
averageRating?: number | null;
reviewCount?: number;
createdAt?: string;
updatedAt?: string;
};
export type UpdateBusinessPayload = {
title?: string;
subtitle?: string | null;
description?: string | null;
address?: string | null;
contactPhone?: string | null;
phone?: string | null;
isActive?: boolean;
concurrentCapacity?: number;
slotStepMinutes?: number;
serviceClassesEnabled?: boolean;
autoApproveBookings?: boolean;
tipsEnabled?: boolean;
promoDiscountEnabled?: boolean;
promoDiscountTitle?: string | null;
promoDiscountPercent?: number | null;
promoDiscountCode?: string | null;
promoDiscountMode?: 'first_booking' | 'always';
};
export type ServiceTemplate = {
id: string;
title: string;
slug: string;
description?: string | null;
defaultDurationMinutes?: number | null;
isActive: boolean;
categoryId: string;
};
export type BusinessServiceClassPrice = {
id: string;
classId: string;
price: string;
durationMinutes?: number | null;
isActive: boolean;
};
export type BusinessServiceClass = {
id: string;
businessId: string;
title: string;
description?: string | null;
sortOrder: number;
isActive: boolean;
classPrices?: BusinessServiceClassPrice[];
};
export type BusinessService = {
id: string;
businessId: string;
serviceTemplateId: string;
price: string;
durationMinutes?: number | null;
isActive: boolean;
loyaltyEnabled?: boolean;
loyaltyEveryN?: number | null;
serviceTemplate?: ServiceTemplate;
classPrices?: BusinessServiceClassPrice[];
};
export type ServiceLoyaltyStatus = {
enabled: boolean;
everyN: number | null;
paidCount: number;
nextIsFree: boolean;
remainingPaidVisits: number | null;
};
export type Booking = {
id: string;
customerId: string;
businessId: string;
businessServiceId: string;
serviceClassId?: string | null;
bookingGroupId?: string | null;
scheduledAt: string;
status: BookingStatus;
note?: string | null;
cancellationReason?: string | null;
paymentToken?: string | null;
paymentAmount?: string | null;
loyaltyRedeemed?: boolean;
promoDiscountApplied?: boolean;
promoDiscountPercent?: number | null;
promoDiscountTitle?: string | null;
business?: Business;
businessService?: BusinessService;
serviceClass?: BusinessServiceClass;
customer?: {
id: string;
mobile: string;
fullName?: string | null;
};
};
export type BusinessRegistrationRequest = {
id: string;
status: string;
businessTitle: string;
categoryId: string;
ownerMobile: string;
createdAt: string;
};
export type CreateBusinessRegistrationPayload = {
businessTitle: string;
categoryId: string;
description?: string;
address?: string;
phone?: string;
};
export type BusinessServiceRequestStatus = 'pending' | 'approved' | 'rejected';
export type BusinessServiceRequest = {
id: string;
businessId: string;
status: BusinessServiceRequestStatus;
title: string;
description?: string | null;
price: string;
durationMinutes?: number | null;
adminNote?: string | null;
createdAt: string;
};
export type CreateBusinessServiceRequestPayload = {
businessId: string;
title: string;
description?: string;
price: number;
durationMinutes?: number;
};