// API配置
const API_CONFIG = {
    BASE_URL: 'http://localhost:8080/api',
    TIMEOUT: 30000
};

// API端点
const API = {
    // 认证
    LOGIN: '/auth/login',
    LOGOUT: '/auth/logout',
    REGISTER: '/auth/register',

    // 用户
    USERS: '/users',
    USER: (id) => `/users/${id}`,
    USERS_ROLE: (role) => `/users/role/${role}`,
    CHANGE_PASSWORD: (id) => `/users/${id}/password`,

    // 客户
    CUSTOMERS: '/customers',
    CUSTOMER: (id) => `/customers/${id}`,

    // 车辆
    VEHICLES: '/vehicles',
    VEHICLE: (id) => `/vehicles/${id}`,
    VEHICLE_CUSTOMER: (customerId) => `/vehicles/customer/${customerId}`,
    VEHICLE_PLATE: (plate) => `/vehicles/plate/${plate}`,

    // 工单
    ORDERS: '/orders',
    ORDER: (id) => `/orders/${id}`,
    ORDER_CUSTOMER: (customerId) => `/orders/customer/${customerId}`,
    ORDER_VEHICLE: (vehicleId) => `/orders/vehicle/${vehicleId}`,
    ORDER_STATUS: (status) => `/orders/status/${status}`,

    // 配件
    PARTS: '/parts',
    PART: (id) => `/parts/${id}`,
    PARTS_CATEGORY: (category) => `/parts/category/${category}`,
    PARTS_LOW_STOCK: '/parts/low-stock',

    // 预约
    APPOINTMENTS: '/appointments',
    APPOINTMENT: (id) => `/appointments/${id}`,
    APPOINTMENT_CUSTOMER: (customerId) => `/appointments/customer/${customerId}`,
    APPOINTMENT_STATUS: (status) => `/appointments/status/${status}`,
    APPOINTMENT_CANCEL: (id) => `/appointments/${id}/cancel`
};

// 本地存储键名
const STORAGE = {
    TOKEN: 'car_maintenance_token',
    USER: 'car_maintenance_user',
    REMEMBER: 'car_maintenance_remember'
};

// 角色类型
const ROLES = {
    ADMIN: 'admin',
    STAFF: 'staff',
    CUSTOMER: 'customer'
};

// 服务类型
const SERVICE_TYPES = {
    MAINTENANCE: 'maintenance',
    REPAIR: 'repair',
    BEAUTY: 'beauty',
    INSURANCE: 'insurance'
};

// 工单状态
const ORDER_STATUS = {
    PENDING: 'pending',
    APPOINTED: 'appointed',
    IN_PROGRESS: 'in_progress',
    COMPLETED: 'completed',
    CANCELLED: 'cancelled'
};

// 支付状态
const PAYMENT_STATUS = {
    UNPAID: 'unpaid',
    PAID: 'paid',
    REFUNDED: 'refunded'
};

// 预约状态
const APPOINTMENT_STATUS = {
    PENDING: 'pending',
    CONFIRMED: 'confirmed',
    COMPLETED: 'completed',
    CANCELLED: 'cancelled'
};
