/**
 * Bungie.Net API
 * These endpoints constitute the functionality exposed by Bungie.net, both for more traditional website functionality and for connectivity to Bungie video games and their related functionality.
 *
 * OpenAPI spec version: 2.1.5
 * Contact: support@bungie.com
 *
 * NOTE: This class is auto generated by the bungie-api-ts code generator program.
 * https://github.com/DestinyItemManager/bugie-api-ts
 * Do not edit these files manually.
 */

import {
  BungieMembershipType,
  PagedQuery,
  PlatformErrorCodes
} from '../common';
import {
  DestinyProgression
} from '../destiny2/interfaces';
import {
  UserInfoCard,
  UserMembership
} from '../user/interfaces';

export interface GroupResponse {
  readonly detail: GroupV2;
  readonly founder: GroupMember;
  readonly alliedIds: string[];
  readonly parentGroup: GroupV2;
  readonly allianceStatus: GroupAllianceStatus;
  readonly groupJoinInviteCount: number;
  /**
   * This property will be populated if the authenticated user is a member of the
   * group. Note that because of account linking, a user can sometimes be part of a
   * clan more than once. As such, this returns the highest member type available.
   */
  readonly currentUserMemberMap: { [key: number]: GroupMember };
  /**
   * This property will be populated if the authenticated user is an applicant or has
   * an outstanding invitation to join. Note that because of account linking, a user
   * can sometimes be part of a clan more than once.
   */
  readonly currentUserPotentialMemberMap: { [key: number]: GroupPotentialMember };
}

export interface GroupV2 {
  readonly groupId: string;
  readonly name: string;
  readonly groupType: GroupType;
  readonly membershipIdCreated: string;
  readonly creationDate: string;
  readonly modificationDate: string;
  readonly about: string;
  readonly tags: string[];
  readonly memberCount: number;
  readonly isPublic: boolean;
  readonly isPublicTopicAdminOnly: boolean;
  readonly primaryAlliedGroupId: string;
  readonly motto: string;
  readonly allowChat: boolean;
  readonly isDefaultPostPublic: boolean;
  readonly chatSecurity: ChatSecuritySetting;
  readonly locale: string;
  readonly avatarImageIndex: number;
  readonly homepage: GroupHomepage;
  readonly membershipOption: MembershipOption;
  readonly defaultPublicity: GroupPostPublicity;
  readonly theme: string;
  readonly bannerPath: string;
  readonly avatarPath: string;
  readonly isAllianceOwner: boolean;
  readonly conversationId: string;
  readonly enableInvitationMessagingForAdmins: boolean;
  readonly banExpireDate?: string;
  readonly features: GroupFeatures;
  readonly clanInfo: GroupV2ClanInfoAndInvestment;
}

export const enum GroupType {
  General = 0,
  Clan = 1
}

export const enum ChatSecuritySetting {
  Group = 0,
  Admins = 1
}

export const enum GroupHomepage {
  Wall = 0,
  Forum = 1,
  AllianceForum = 2
}

export const enum MembershipOption {
  Reviewed = 0,
  Open = 1,
  Closed = 2
}

export const enum GroupPostPublicity {
  Public = 0,
  Alliance = 1,
  Private = 2
}

export interface GroupFeatures {
  readonly maximumMembers: number;
  /**
   * Maximum number of groups of this type a typical membership may join. For example,
   * a user may join about 50 General groups with their Bungie.net account. They may
   * join one clan per Destiny membership.
   */
  readonly maximumMembershipsOfGroupType: number;
  readonly capabilities: Capabilities;
  readonly membershipTypes: BungieMembershipType[];
  /**
   * Minimum Member Level allowed to invite new members to group
   *
   * Always Allowed: Founder, Acting Founder
   *
   * True means admins have this power, false means they don't
   *
   * Default is false for clans, true for groups.
   */
  readonly invitePermissionOverride: boolean;
  /**
   * Minimum Member Level allowed to update group culture
   *
   * Always Allowed: Founder, Acting Founder
   *
   * True means admins have this power, false means they don't
   *
   * Default is false for clans, true for groups.
   */
  readonly updateCulturePermissionOverride: boolean;
  /**
   * Minimum Member Level allowed to host guided games
   *
   * Always Allowed: Founder, Acting Founder, Admin
   *
   * Allowed Overrides: None, Member, Beginner
   *
   * Default is Member for clans, None for groups, although this means nothing for
   * groups.
   */
  readonly hostGuidedGamePermissionOverride: HostGuidedGamesPermissionLevel;
  /**
   * Minimum Member Level allowed to update banner
   *
   * Always Allowed: Founder, Acting Founder
   *
   * True means admins have this power, false means they don't
   *
   * Default is false for clans, true for groups.
   */
  readonly updateBannerPermissionOverride: boolean;
  /**
   * Level to join a member at when accepting an invite, application, or joining an
   * open clan
   *
   * Default is Beginner.
   */
  readonly joinLevel: RuntimeGroupMemberType;
}

export const enum Capabilities {
  None = 0,
  Leaderboards = 1,
  Callsign = 2,
  OptionalConversations = 4,
  ClanBanner = 8,
  D2InvestmentData = 16,
  Tags = 32,
  Alliances = 64
}

export const enum HostGuidedGamesPermissionLevel {
  None = 0,
  Beginner = 1,
  Member = 2
}

export const enum RuntimeGroupMemberType {
  None = 0,
  Beginner = 1,
  Member = 2,
  Admin = 3,
  ActingFounder = 4,
  Founder = 5
}

/** The same as GroupV2ClanInfo, but includes any investment data. */
export interface GroupV2ClanInfoAndInvestment {
  readonly d2ClanProgressions: { [key: number]: DestinyProgression };
  readonly clanCallsign: string;
  readonly clanBannerData: ClanBanner;
}

export interface ClanBanner {
  readonly decalId: number;
  readonly decalColorId: number;
  readonly decalBackgroundColorId: number;
  readonly gonfalonId: number;
  readonly gonfalonColorId: number;
  readonly gonfalonDetailId: number;
  readonly gonfalonDetailColorId: number;
}

export interface GroupMember {
  readonly memberType: RuntimeGroupMemberType;
  readonly isOnline: boolean;
  readonly groupId: string;
  readonly destinyUserInfo: UserInfoCard;
  readonly bungieNetUserInfo: UserInfoCard;
  readonly joinDate: string;
}

export const enum GroupAllianceStatus {
  Unallied = 0,
  Parent = 1,
  Child = 2
}

export interface GroupPotentialMember {
  readonly potentialStatus: GroupPotentialMemberStatus;
  readonly groupId: string;
  readonly destinyUserInfo: UserInfoCard;
  readonly bungieNetUserInfo: UserInfoCard;
  readonly joinDate: string;
}

export const enum GroupPotentialMemberStatus {
  None = 0,
  Applicant = 1,
  Invitee = 2
}

export const enum GroupDateRange {
  All = 0,
  PastDay = 1,
  PastWeek = 2,
  PastMonth = 3,
  PastYear = 4
}

export interface GroupQuery {
  readonly name: string;
  readonly groupType: GroupType;
  readonly creationDate: GroupDateRange;
  readonly sortBy: GroupSortBy;
  readonly groupMemberCountFilter?: number;
  readonly localeFilter: string;
  readonly tagText: string;
  readonly itemsPerPage: number;
  readonly currentPage: number;
  readonly requestContinuationToken: string;
}

export interface GroupAction {
  /** Type of group, either Bungie.net hosted group, or a game services hosted clan. */
  readonly groupType: GroupType;
  readonly name: string;
  readonly about: string;
  readonly motto: string;
  readonly theme: string;
  readonly avatarImageIndex: number;
  readonly tags: string;
  readonly isPublic: boolean;
  readonly membershipOption: MembershipOption;
  readonly isPublicTopicAdminOnly: boolean;
  readonly isDefaultPostPublic: boolean;
  readonly allowChat: boolean;
  readonly isDefaultPostAlliance: boolean;
  readonly chatSecurity: ChatSecuritySetting;
  readonly callsign: string;
  readonly locale: string;
  readonly homepage: GroupHomepage;
  /**
   * When operation needs a platform specific account ID for the present user, use
   * this property. In particular, groupType of Clan requires this value to be set.
   */
  readonly platformMembershipType: BungieMembershipType;
}

export interface GroupEditAction {
  readonly name: string;
  readonly about: string;
  readonly motto: string;
  readonly theme: string;
  readonly avatarImageIndex?: number;
  readonly tags: string;
  readonly isPublic?: boolean;
  readonly membershipOption?: number;
  readonly isPublicTopicAdminOnly?: boolean;
  readonly allowChat?: boolean;
  readonly chatSecurity?: number;
  readonly callsign: string;
  readonly locale: string;
  readonly homepage?: number;
  readonly enableInvitationMessagingForAdmins?: boolean;
  readonly defaultPublicity?: number;
}

export interface GroupOptionsEditAction {
  /**
   * Minimum Member Level allowed to invite new members to group
   *
   * Always Allowed: Founder, Acting Founder
   *
   * True means admins have this power, false means they don't
   *
   * Default is false for clans, true for groups.
   */
  readonly InvitePermissionOverride?: boolean;
  /**
   * Minimum Member Level allowed to update group culture
   *
   * Always Allowed: Founder, Acting Founder
   *
   * True means admins have this power, false means they don't
   *
   * Default is false for clans, true for groups.
   */
  readonly UpdateCulturePermissionOverride?: boolean;
  /**
   * Minimum Member Level allowed to host guided games
   *
   * Always Allowed: Founder, Acting Founder, Admin
   *
   * Allowed Overrides: None, Member, Beginner
   *
   * Default is Member for clans, None for groups, although this means nothing for
   * groups.
   */
  readonly HostGuidedGamePermissionOverride?: number;
  /**
   * Minimum Member Level allowed to update banner
   *
   * Always Allowed: Founder, Acting Founder
   *
   * True means admins have this power, false means they don't
   *
   * Default is false for clans, true for groups.
   */
  readonly UpdateBannerPermissionOverride?: boolean;
  /**
   * Level to join a member at when accepting an invite, application, or joining an
   * open clan
   *
   * Default is Beginner.
   */
  readonly JoinLevel?: number;
}

export interface GroupOptionalConversationAddRequest {
  readonly chatName: string;
  readonly chatSecurity: ChatSecuritySetting;
}

export interface GroupOptionalConversationEditRequest {
  readonly chatEnabled?: boolean;
  readonly chatName: string;
  readonly chatSecurity?: number;
}

export interface GroupBanRequest {
  readonly comment: string;
  readonly length: IgnoreLength;
}

export interface GroupApplicationRequest {
  readonly message: string;
}

export interface GroupApplicationListRequest {
  readonly memberships: UserMembership[];
  readonly message: string;
}

export const enum GroupsForMemberFilter {
  All = 0,
  Founded = 1,
  NonFounded = 2
}

export interface GroupTheme {
  readonly name: string;
  readonly folder: string;
  readonly description: string;
}

/**
 * A small infocard of group information, usually used for when a list of groups
 * are returned
 */
export interface GroupV2Card {
  readonly groupId: string;
  readonly name: string;
  readonly groupType: GroupType;
  readonly creationDate: string;
  readonly about: string;
  readonly motto: string;
  readonly memberCount: number;
  readonly locale: string;
  readonly membershipOption: MembershipOption;
  readonly capabilities: Capabilities;
  readonly clanInfo: GroupV2ClanInfo;
  readonly avatarPath: string;
  readonly theme: string;
}

/**
 * This contract contains clan-specific group information. It does not include any
 * investment data.
 */
export interface GroupV2ClanInfo {
  readonly clanCallsign: string;
  readonly clanBannerData: ClanBanner;
}

export const enum GroupSortBy {
  Name = 0,
  Date = 1,
  Popularity = 2,
  Id = 3
}

export interface GroupSearchResponse {
  readonly results: GroupV2Card[];
  readonly totalResults: number;
  readonly hasMore: boolean;
  readonly query: PagedQuery;
  readonly replacementContinuationToken: string;
  /**
   * If useTotalResults is true, then totalResults represents an accurate count.
   *
   * If False, it does not, and may be estimated/only the size of the current page.
   *
   * Either way, you should probably always only trust hasMore.
   *
   * This is a long-held historical throwback to when we used to do paging with known
   * total results. Those queries toasted our database, and we were left to hastily
   * alter our endpoints and create backward- compatible shims, of which
   * useTotalResults is one.
   */
  readonly useTotalResults: boolean;
}

export interface GroupOptionalConversation {
  readonly groupId: string;
  readonly conversationId: string;
  readonly chatEnabled: boolean;
  readonly chatName: string;
  readonly chatSecurity: ChatSecuritySetting;
}

export interface GroupCreationResponse {
  readonly groupId: string;
}

export interface SearchResultOfGroupMember {
  readonly results: GroupMember[];
  readonly totalResults: number;
  readonly hasMore: boolean;
  readonly query: PagedQuery;
  readonly replacementContinuationToken: string;
  /**
   * If useTotalResults is true, then totalResults represents an accurate count.
   *
   * If False, it does not, and may be estimated/only the size of the current page.
   *
   * Either way, you should probably always only trust hasMore.
   *
   * This is a long-held historical throwback to when we used to do paging with known
   * total results. Those queries toasted our database, and we were left to hastily
   * alter our endpoints and create backward- compatible shims, of which
   * useTotalResults is one.
   */
  readonly useTotalResults: boolean;
}

export interface GroupMemberLeaveResult {
  readonly group: GroupV2;
  readonly groupDeleted: boolean;
}

export const enum IgnoreLength {
  None = 0,
  Week = 1,
  TwoWeeks = 2,
  ThreeWeeks = 3,
  Month = 4,
  ThreeMonths = 5,
  SixMonths = 6,
  Year = 7,
  Forever = 8,
  ThreeMinutes = 9,
  Hour = 10,
  ThirtyDays = 11
}

export interface SearchResultOfGroupBan {
  readonly results: GroupBan[];
  readonly totalResults: number;
  readonly hasMore: boolean;
  readonly query: PagedQuery;
  readonly replacementContinuationToken: string;
  /**
   * If useTotalResults is true, then totalResults represents an accurate count.
   *
   * If False, it does not, and may be estimated/only the size of the current page.
   *
   * Either way, you should probably always only trust hasMore.
   *
   * This is a long-held historical throwback to when we used to do paging with known
   * total results. Those queries toasted our database, and we were left to hastily
   * alter our endpoints and create backward- compatible shims, of which
   * useTotalResults is one.
   */
  readonly useTotalResults: boolean;
}

export interface GroupBan {
  readonly groupId: string;
  readonly lastModifiedBy: UserInfoCard;
  readonly createdBy: UserInfoCard;
  readonly dateBanned: string;
  readonly dateExpires: string;
  readonly comment: string;
  readonly bungieNetUserInfo: UserInfoCard;
  readonly destinyUserInfo: UserInfoCard;
}

export interface GroupApplicationResponse {
  readonly resolution: GroupApplicationResolveState;
}

export const enum GroupApplicationResolveState {
  Unresolved = 0,
  Accepted = 1,
  Denied = 2,
  Rescinded = 3
}

export interface SearchResultOfGroupMemberApplication {
  readonly results: GroupMemberApplication[];
  readonly totalResults: number;
  readonly hasMore: boolean;
  readonly query: PagedQuery;
  readonly replacementContinuationToken: string;
  /**
   * If useTotalResults is true, then totalResults represents an accurate count.
   *
   * If False, it does not, and may be estimated/only the size of the current page.
   *
   * Either way, you should probably always only trust hasMore.
   *
   * This is a long-held historical throwback to when we used to do paging with known
   * total results. Those queries toasted our database, and we were left to hastily
   * alter our endpoints and create backward- compatible shims, of which
   * useTotalResults is one.
   */
  readonly useTotalResults: boolean;
}

export interface GroupMemberApplication {
  readonly groupId: string;
  readonly creationDate: string;
  readonly resolveState: GroupApplicationResolveState;
  readonly resolveDate?: string;
  readonly resolvedByMembershipId?: string;
  readonly requestMessage: string;
  readonly resolveMessage: string;
  readonly destinyUserInfo: UserInfoCard;
  readonly bungieNetUserInfo: UserInfoCard;
}

export interface EntityActionResult {
  readonly entityId: string;
  readonly result: PlatformErrorCodes;
}

export interface GroupMembershipSearchResponse {
  readonly results: GroupMembership[];
  readonly totalResults: number;
  readonly hasMore: boolean;
  readonly query: PagedQuery;
  readonly replacementContinuationToken: string;
  /**
   * If useTotalResults is true, then totalResults represents an accurate count.
   *
   * If False, it does not, and may be estimated/only the size of the current page.
   *
   * Either way, you should probably always only trust hasMore.
   *
   * This is a long-held historical throwback to when we used to do paging with known
   * total results. Those queries toasted our database, and we were left to hastily
   * alter our endpoints and create backward- compatible shims, of which
   * useTotalResults is one.
   */
  readonly useTotalResults: boolean;
}

export interface GroupMembership {
  readonly member: GroupMember;
  readonly group: GroupV2;
}

export interface GroupPotentialMembershipSearchResponse {
  readonly results: GroupPotentialMembership[];
  readonly totalResults: number;
  readonly hasMore: boolean;
  readonly query: PagedQuery;
  readonly replacementContinuationToken: string;
  /**
   * If useTotalResults is true, then totalResults represents an accurate count.
   *
   * If False, it does not, and may be estimated/only the size of the current page.
   *
   * Either way, you should probably always only trust hasMore.
   *
   * This is a long-held historical throwback to when we used to do paging with known
   * total results. Those queries toasted our database, and we were left to hastily
   * alter our endpoints and create backward- compatible shims, of which
   * useTotalResults is one.
   */
  readonly useTotalResults: boolean;
}

export interface GroupPotentialMembership {
  readonly member: GroupPotentialMember;
  readonly group: GroupV2;
}
