package com.discord.widgets.guildscheduledevent; import androidx.annotation.DrawableRes; import c.d.b.a.a; import c0.z.d.m; import com.discord.R; import com.discord.api.channel.Channel; import com.discord.api.guildscheduledevent.GuildScheduledEvent; import com.discord.api.guildscheduledevent.GuildScheduledEventEntityMetadata; import com.discord.api.guildscheduledevent.GuildScheduledEventEntityType; import com.discord.models.domain.ModelAuditLogEntry; import kotlin.NoWhenBranchMatchedException; import kotlin.jvm.internal.DefaultConstructorMarker; /* compiled from: GuildScheduledEventLocationInfo.kt */ public abstract class GuildScheduledEventLocationInfo { public static final Companion Companion = new Companion(null); /* compiled from: GuildScheduledEventLocationInfo.kt */ public static final class ChannelLocation extends GuildScheduledEventLocationInfo { private final Channel channel; public ChannelLocation(Channel channel) { super(null); this.channel = channel; } public static /* synthetic */ ChannelLocation copy$default(ChannelLocation channelLocation, Channel channel, int i, Object obj) { if ((i & 1) != 0) { channel = channelLocation.channel; } return channelLocation.copy(channel); } public final Channel component1() { return this.channel; } public final ChannelLocation copy(Channel channel) { return new ChannelLocation(channel); } public boolean equals(Object obj) { if (this != obj) { return (obj instanceof ChannelLocation) && m.areEqual(this.channel, ((ChannelLocation) obj).channel); } return true; } public final Channel getChannel() { return this.channel; } public int hashCode() { Channel channel = this.channel; if (channel != null) { return channel.hashCode(); } return 0; } public String toString() { StringBuilder O = a.O("ChannelLocation(channel="); O.append(this.channel); O.append(")"); return O.toString(); } } /* compiled from: GuildScheduledEventLocationInfo.kt */ public static final class Companion { private Companion() { } public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } public final GuildScheduledEventLocationInfo buildLocationInfo(GuildScheduledEvent guildScheduledEvent, Channel channel) { String str; m.checkNotNullParameter(guildScheduledEvent, "guildScheduledEvent"); if (guildScheduledEvent.e() != GuildScheduledEventEntityType.EXTERNAL) { return new ChannelLocation(channel); } GuildScheduledEventEntityMetadata d = guildScheduledEvent.d(); if (d == null || (str = d.a()) == null) { str = ""; } return new ExternalLocation(str); } public final GuildScheduledEventLocationInfo buildLocationInfo(GuildScheduledEventModel guildScheduledEventModel, Channel channel) { String str; m.checkNotNullParameter(guildScheduledEventModel, "guildScheduledEventModel"); if (guildScheduledEventModel.getEntityType() != GuildScheduledEventEntityType.EXTERNAL) { return new ChannelLocation(channel); } GuildScheduledEventEntityMetadata entityMetadata = guildScheduledEventModel.getEntityMetadata(); if (entityMetadata == null || (str = entityMetadata.a()) == null) { str = ""; } return new ExternalLocation(str); } } /* compiled from: GuildScheduledEventLocationInfo.kt */ public static final class ExternalLocation extends GuildScheduledEventLocationInfo { private final String location; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public ExternalLocation(String str) { super(null); m.checkNotNullParameter(str, ModelAuditLogEntry.CHANGE_KEY_LOCATION); this.location = str; } public static /* synthetic */ ExternalLocation copy$default(ExternalLocation externalLocation, String str, int i, Object obj) { if ((i & 1) != 0) { str = externalLocation.location; } return externalLocation.copy(str); } public final String component1() { return this.location; } public final ExternalLocation copy(String str) { m.checkNotNullParameter(str, ModelAuditLogEntry.CHANGE_KEY_LOCATION); return new ExternalLocation(str); } public boolean equals(Object obj) { if (this != obj) { return (obj instanceof ExternalLocation) && m.areEqual(this.location, ((ExternalLocation) obj).location); } return true; } public final String getLocation() { return this.location; } public int hashCode() { String str = this.location; if (str != null) { return str.hashCode(); } return 0; } public String toString() { return a.G(a.O("ExternalLocation(location="), this.location, ")"); } } private GuildScheduledEventLocationInfo() { } public /* synthetic */ GuildScheduledEventLocationInfo(DefaultConstructorMarker defaultConstructorMarker) { this(); } @DrawableRes private final int getChannelIcon(Channel channel) { Integer valueOf = channel != null ? Integer.valueOf(channel.A()) : null; return ((valueOf != null && valueOf.intValue() == 2) || valueOf == null || valueOf.intValue() != 13) ? R.drawable.ic_channel_voice : R.drawable.ic_stage_20dp; } @DrawableRes private final int getChannelIconSmall(Channel channel) { Integer valueOf = channel != null ? Integer.valueOf(channel.A()) : null; return ((valueOf != null && valueOf.intValue() == 2) || valueOf == null || valueOf.intValue() != 13) ? R.drawable.ic_channel_voice_16dp : R.drawable.ic_channel_stage_16dp; } @DrawableRes public final int getLocationIcon() { if (this instanceof ChannelLocation) { return getChannelIcon(((ChannelLocation) this).getChannel()); } if (this instanceof ExternalLocation) { return R.drawable.ic_location_24dp; } throw new NoWhenBranchMatchedException(); } @DrawableRes public final int getLocationIconSmall() { if (this instanceof ChannelLocation) { return getChannelIconSmall(((ChannelLocation) this).getChannel()); } if (this instanceof ExternalLocation) { return R.drawable.ic_location_16dp; } throw new NoWhenBranchMatchedException(); } public final String getLocationName() { String m; if (this instanceof ChannelLocation) { Channel channel = ((ChannelLocation) this).getChannel(); return (channel == null || (m = channel.m()) == null) ? "" : m; } else if (this instanceof ExternalLocation) { return ((ExternalLocation) this).getLocation(); } else { throw new NoWhenBranchMatchedException(); } } }