import type { EffectiveAccessResult, ServiceAppRole } from "../access/types";

export type ServiceStatus = "active" | "maintenance" | "hidden" | "disabled";
export type MediaKind = "image" | "video" | "gif" | "gradient";
export type ServiceMediaSource = "url" | "file";

export interface Service {
  id: string;
  slug: string;
  title: string;
  subtitle?: string | null;
  description: string;
  fullDescription?: string | null;
  url: string;
  launchUrl?: string | null;
  logoutUrl?: string | null;
  iconUrl?: string | null;
  coverImageUrl?: string | null;
  coverMediaKind?: MediaKind | null;
  coverMediaSource?: ServiceMediaSource | null;
  coverMediaFileName?: string | null;
  previewVideoUrl?: string | null;
  ambientVideoUrl?: string | null;
  ambientMediaKind?: MediaKind | null;
  ambientMediaSource?: ServiceMediaSource | null;
  ambientMediaFileName?: string | null;
  accentColor?: string | null;
  fallbackGradient?: string | null;
  status: ServiceStatus;
  order: number;
  authentikApplicationSlug?: string | null;
  authentikGroupName?: string | null;
  isAvailableForAllNewClients?: boolean;
  createdAt: string;
  updatedAt: string;
}

export interface ServiceMedia {
  kind: MediaKind;
  url?: string;
  posterUrl?: string;
  fallbackGradient?: string;
}

export interface LauncherServiceView {
  id: string;
  slug: string;
  title: string;
  subtitle?: string | null;
  description: string;
  fullDescription?: string | null;
  status: ServiceStatus;
  userAccess: "allowed" | "denied";
  appRole?: ServiceAppRole;
  openUrl?: string | null;
  accentColor?: string | null;
  media: {
    icon?: string | null;
    thumbnail?: string | null;
    coverImage?: string | null;
    coverKind?: MediaKind | null;
    coverSource?: ServiceMediaSource | null;
    coverFileName?: string | null;
    previewVideo?: string | null;
    ambientVideo?: string | null;
    ambientKind?: MediaKind | null;
    ambientSource?: ServiceMediaSource | null;
    ambientFileName?: string | null;
    fallbackGradient?: string | null;
  };
  effectiveAccess: EffectiveAccessResult;
}
