import {User} from '@interfaces/user';

export enum ChatUserStatus {
  Active = 'ACTIVE',
  Unclaimed = 'UNCLAIMED',
  Deactivated = 'DEACTIVATED',
  /**
   * Local status. When user is deleted from server (deleted_at is set)
   */
  Deleted = 'DELETED',
}

export interface ChatUser {
  id: string;
  name: string;
  tz: string;
  profile: {
    email: string;
    image_24: Nullable<string>;
    image_32: Nullable<string>;
    image_48: Nullable<string>;
    image_72: Nullable<string>;
    image_192: Nullable<string>;
    image_512: Nullable<string>;
  };
  updated: Nullable<number>;
  hu_data: {
    member: HuDataMember;
  };
}

export interface HuDataMember {
  id: number;
  first_name: string;
  last_name: string;
  employee_internal_id: string;
  /**
   * Field for the asset url. This url does not contain S3 signature.
   * It must use access token to get the image.
   */
  picture_asset_url: Nullable<string>;
  status: ChatUserStatus;
  email: Nullable<string>;
  deleted_at?: number;
  version: number;
}

export interface OtherMembership {
  id: string;
  version: number;
  user: {
    hu_data: {
      member: HuDataMember;
    };
    id: number;
    team_id: string;
    name: string;
  };
  properties?: {
    notification_status: {
      notification_type: 'ALL' | 'MUTED';
      until: Nullable<string>;
    };
  };
}

export type MentionUser = Pick<
  User,
  'firstName' | 'lastName' | 'profilePicture'
> & {
  /**
   * The id of the user.
   * For command mentions, the id is a negative number.
   */
  id: number;
};
