import { Prisma } from '@/generated/prisma/client';

declare global {
  type AuditWithUser = Prisma.AuditGetPayload<{
    include: {
      user: {
        select: {
          id: true;
          name: true;
        };
      };
    };
  }>;

  type HouseWithMembers = Prisma.HouseGetPayload<{
    include: {
      members: {
        select: {
          role: true;
          user: {
            select: {
              id: true;
              name: true;
              email: true;
              image: true;
            };
          };
        };
      };
    };
  }>;

  type BoxWithCount = Prisma.BoxGetPayload<{
    include: {
      _count: {
        select: {
          items: true;
        };
      };
      house: {
        select: {
          id: true;
          name: true;
          color: true;
        };
      };
      user: {
        select: {
          id: true;
          name: true;
          email: true;
          image: true;
          role: true;
        };
      };
    };
    omit: {
      createrId: true;
      houseId: true;
    };
  }>;

  type HouseWithMembersCount = HouseWithMembers & {
    _count: {
      members: number;
    };
  };

  type NotificationWithUser = Prisma.NotificationGetPayload<{
    include: {
      user: {
        select: {
          id: true;
          name: true;
          email: true;
          image: true;
        };
      };
    };
  }>;

  type ReturnError = Error & {
    code: string;
    message: string;
  };
}
