import Redis from "ioredis";
import { schema } from "@slackwsh/data";
import type { CreateScheduledStatusRequest, SetStatusRequest, UpdateAutomaticStatusPreferencesRequest } from "@slackwsh/contracts";
type Member = typeof schema.workspaceMembers.$inferSelect;
type Schedule = typeof schema.scheduledStatuses.$inferSelect;
export interface EffectiveStatus {
    text: string | null;
    emoji: string | null;
    expiresAt: string | null;
    source: "manual" | "scheduled" | "connect" | "focus" | "outside_hours" | null;
    dndActive: boolean;
    dndUntil: string | null;
}
export declare function resolveEffectiveStatus(member: Member, schedules: Schedule[], timezone: string, now?: Date): EffectiveStatus;
export declare class StatusService {
    private readonly redis;
    constructor(redis: Redis);
    resolveMemberRows(workspaceId: number, actorUserId: number, rows: Array<{
        member: Member;
        user: typeof schema.users.$inferSelect;
    }>): Promise<{
        member: {
            statusText: string | null;
            statusEmoji: string | null;
            statusExpiresAt: string | null;
            statusSource: "connect" | "manual" | "scheduled" | "focus" | "outside_hours" | null;
            dndActive: boolean;
            dndUntil: string | null;
            workspaceId: number;
            userId: number;
            role: "owner" | "admin" | "member" | "multi_channel_guest" | "single_channel_guest" | "bot";
            displayName: string | null;
            title: string | null;
            availabilityMode: string;
            dndEnabled: boolean;
            autoStatusConnect: boolean;
            autoStatusFocus: boolean;
            autoStatusOutsideHours: boolean;
            focusModeEnabled: boolean;
            inConnect: boolean;
            workHoursStart: string;
            workHoursEnd: string;
            workingDays: unknown;
            joinedAt: Date;
            deactivatedAt: Date | null;
        };
        user: typeof schema.users.$inferSelect;
    }[]>;
    getMine(workspaceId: number, userId: number): Promise<{
        manual: {
            text: string | null;
            emoji: string | null;
            expiresAt: string | null;
            pauseNotifications: boolean;
        };
        effective: EffectiveStatus;
        availabilityMode: string;
        automatic: {
            connect: boolean;
            focus: boolean;
            outsideWorkingHours: boolean;
            focusModeEnabled: boolean;
            inConnect: boolean;
            workHoursStart: string;
            workHoursEnd: string;
            workingDays: any[];
        };
        schedules: {
            id: number;
            text: string;
            emoji: string;
            startsAt: string;
            endsAt: string;
            pauseNotifications: boolean;
        }[];
    }>;
    setStatus(workspaceId: number, userId: number, input: SetStatusRequest): Promise<{
        manual: {
            text: string | null;
            emoji: string | null;
            expiresAt: string | null;
            pauseNotifications: boolean;
        };
        effective: EffectiveStatus;
        availabilityMode: string;
        automatic: {
            connect: boolean;
            focus: boolean;
            outsideWorkingHours: boolean;
            focusModeEnabled: boolean;
            inConnect: boolean;
            workHoursStart: string;
            workHoursEnd: string;
            workingDays: any[];
        };
        schedules: {
            id: number;
            text: string;
            emoji: string;
            startsAt: string;
            endsAt: string;
            pauseNotifications: boolean;
        }[];
    }>;
    setAvailability(workspaceId: number, userId: number, mode: "auto" | "away" | "available"): Promise<{
        manual: {
            text: string | null;
            emoji: string | null;
            expiresAt: string | null;
            pauseNotifications: boolean;
        };
        effective: EffectiveStatus;
        availabilityMode: string;
        automatic: {
            connect: boolean;
            focus: boolean;
            outsideWorkingHours: boolean;
            focusModeEnabled: boolean;
            inConnect: boolean;
            workHoursStart: string;
            workHoursEnd: string;
            workingDays: any[];
        };
        schedules: {
            id: number;
            text: string;
            emoji: string;
            startsAt: string;
            endsAt: string;
            pauseNotifications: boolean;
        }[];
    }>;
    setContext(workspaceId: number, userId: number, patch: {
        focusModeEnabled?: boolean;
        inConnect?: boolean;
    }): Promise<{
        manual: {
            text: string | null;
            emoji: string | null;
            expiresAt: string | null;
            pauseNotifications: boolean;
        };
        effective: EffectiveStatus;
        availabilityMode: string;
        automatic: {
            connect: boolean;
            focus: boolean;
            outsideWorkingHours: boolean;
            focusModeEnabled: boolean;
            inConnect: boolean;
            workHoursStart: string;
            workHoursEnd: string;
            workingDays: any[];
        };
        schedules: {
            id: number;
            text: string;
            emoji: string;
            startsAt: string;
            endsAt: string;
            pauseNotifications: boolean;
        }[];
    }>;
    updateAutomatic(workspaceId: number, userId: number, input: UpdateAutomaticStatusPreferencesRequest): Promise<{
        manual: {
            text: string | null;
            emoji: string | null;
            expiresAt: string | null;
            pauseNotifications: boolean;
        };
        effective: EffectiveStatus;
        availabilityMode: string;
        automatic: {
            connect: boolean;
            focus: boolean;
            outsideWorkingHours: boolean;
            focusModeEnabled: boolean;
            inConnect: boolean;
            workHoursStart: string;
            workHoursEnd: string;
            workingDays: any[];
        };
        schedules: {
            id: number;
            text: string;
            emoji: string;
            startsAt: string;
            endsAt: string;
            pauseNotifications: boolean;
        }[];
    }>;
    createSchedule(workspaceId: number, userId: number, input: CreateScheduledStatusRequest): Promise<{
        manual: {
            text: string | null;
            emoji: string | null;
            expiresAt: string | null;
            pauseNotifications: boolean;
        };
        effective: EffectiveStatus;
        availabilityMode: string;
        automatic: {
            connect: boolean;
            focus: boolean;
            outsideWorkingHours: boolean;
            focusModeEnabled: boolean;
            inConnect: boolean;
            workHoursStart: string;
            workHoursEnd: string;
            workingDays: any[];
        };
        schedules: {
            id: number;
            text: string;
            emoji: string;
            startsAt: string;
            endsAt: string;
            pauseNotifications: boolean;
        }[];
    }>;
    updateSchedule(workspaceId: number, userId: number, scheduleId: number, input: CreateScheduledStatusRequest): Promise<{
        manual: {
            text: string | null;
            emoji: string | null;
            expiresAt: string | null;
            pauseNotifications: boolean;
        };
        effective: EffectiveStatus;
        availabilityMode: string;
        automatic: {
            connect: boolean;
            focus: boolean;
            outsideWorkingHours: boolean;
            focusModeEnabled: boolean;
            inConnect: boolean;
            workHoursStart: string;
            workHoursEnd: string;
            workingDays: any[];
        };
        schedules: {
            id: number;
            text: string;
            emoji: string;
            startsAt: string;
            endsAt: string;
            pauseNotifications: boolean;
        }[];
    }>;
    deleteSchedule(workspaceId: number, userId: number, scheduleId: number): Promise<{
        manual: {
            text: string | null;
            emoji: string | null;
            expiresAt: string | null;
            pauseNotifications: boolean;
        };
        effective: EffectiveStatus;
        availabilityMode: string;
        automatic: {
            connect: boolean;
            focus: boolean;
            outsideWorkingHours: boolean;
            focusModeEnabled: boolean;
            inConnect: boolean;
            workHoursStart: string;
            workHoursEnd: string;
            workingDays: any[];
        };
        schedules: {
            id: number;
            text: string;
            emoji: string;
            startsAt: string;
            endsAt: string;
            pauseNotifications: boolean;
        }[];
    }>;
    private updateMember;
    private requireMember;
    private changed;
}
export {};
//# sourceMappingURL=status.service.d.ts.map