/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.objectmodel.Goid
 *  com.l7tech.objectmodel.imp.PersistentEntityImp
 *  com.l7tech.util.Charsets
 *  com.l7tech.util.HexUtils
 *  jakarta.persistence.Column
 *  jakarta.persistence.Entity
 *  jakarta.persistence.Table
 *  org.hibernate.annotations.Proxy
 *  org.hibernate.annotations.Type
 */
package com.l7tech.server.secureconversation;

import com.l7tech.objectmodel.Goid;
import com.l7tech.objectmodel.imp.PersistentEntityImp;
import com.l7tech.util.Charsets;
import com.l7tech.util.HexUtils;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import org.hibernate.annotations.Proxy;
import org.hibernate.annotations.Type;

@Entity
@Proxy(lazy=false)
@Table(name="wssc_session")
public class StoredSecureConversationSession
extends PersistentEntityImp {
    private String sessionKey;
    private boolean inbound;
    private String identifier;
    private long created;
    private long expires;
    private String namespace;
    private String token;
    private String serviceUrl;
    private String encryptedKey;
    private Goid providerId;
    private String userId;
    private String userLogin;
    static final long serialVersionUID = 3826066075200087098L;

    public StoredSecureConversationSession(String string, long l2, long l3, String string2, String string3, Goid goid, String string4, String string5) {
        this.sessionKey = StoredSecureConversationSession.generateSessionKey(string);
        this.inbound = true;
        this.identifier = string;
        this.created = l2;
        this.expires = l3;
        this.namespace = string2;
        this.encryptedKey = string3;
        this.providerId = goid;
        this.userId = string4;
        this.userLogin = string5;
    }

    public StoredSecureConversationSession(String string, Goid goid, String string2, String string3, String string4, long l2, long l3, String string5, String string6, String string7) {
        this.sessionKey = StoredSecureConversationSession.generateSessionKey(goid, string2, string);
        this.inbound = false;
        this.identifier = string4;
        this.serviceUrl = string;
        this.created = l2;
        this.expires = l3;
        this.namespace = string5;
        this.token = string6;
        this.encryptedKey = string7;
        this.providerId = goid;
        this.userId = string2;
        this.userLogin = string3;
    }

    @Column(name="session_key_hash", nullable=false, unique=true, updatable=false, length=128)
    public String getSessionKey() {
        return this.sessionKey;
    }

    public void setSessionKey(String string) {
        this.sessionKey = string;
    }

    @Column(name="inbound", updatable=false)
    public boolean isInbound() {
        return this.inbound;
    }

    public void setInbound(boolean bl2) {
        this.inbound = bl2;
    }

    @Column(name="identifier", nullable=false, updatable=false, length=4096)
    public String getIdentifier() {
        return this.identifier;
    }

    public void setIdentifier(String string) {
        this.identifier = string;
    }

    @Column(name="created", updatable=false)
    public long getCreated() {
        return this.created;
    }

    public void setCreated(long l2) {
        this.created = l2;
    }

    @Column(name="expires", updatable=false)
    public long getExpires() {
        return this.expires;
    }

    public void setExpires(long l2) {
        this.expires = l2;
    }

    @Column(name="namespace", updatable=false, length=4096)
    public String getNamespace() {
        return this.namespace;
    }

    public void setNamespace(String string) {
        this.namespace = string;
    }

    @Column(name="token", updatable=false, length=131072)
    public String getToken() {
        return this.token;
    }

    public void setToken(String string) {
        this.token = string;
    }

    @Column(name="service_url", updatable=false, length=4096)
    public String getServiceUrl() {
        return this.serviceUrl;
    }

    public void setServiceUrl(String string) {
        this.serviceUrl = string;
    }

    @Column(name="encrypted_key", updatable=false)
    public String getEncryptedKey() {
        return this.encryptedKey;
    }

    public void setEncryptedKey(String string) {
        this.encryptedKey = string;
    }

    @Column(name="provider_goid", updatable=false)
    @Type(type="com.l7tech.server.util.GoidType")
    public Goid getProviderId() {
        return this.providerId;
    }

    public void setProviderId(Goid goid) {
        this.providerId = goid;
    }

    @Column(name="user_id", updatable=false, length=255)
    public String getUserId() {
        return this.userId;
    }

    public void setUserId(String string) {
        this.userId = string;
    }

    @Column(name="user_login", updatable=false, length=255)
    public String getUserLogin() {
        return this.userLogin;
    }

    public void setUserLogin(String string) {
        this.userLogin = string;
    }

    protected StoredSecureConversationSession() {
    }

    static String generateSessionKey(String string) {
        return HexUtils.encodeBase64((byte[])HexUtils.getSha512Digest((byte[])string.getBytes(Charsets.UTF8)), (boolean)true);
    }

    static String generateSessionKey(Goid goid, String string, String string2) {
        return HexUtils.encodeBase64((byte[])HexUtils.getSha512Digest((byte[][])new byte[][]{Goid.toString((Goid)goid).getBytes(Charsets.UTF8), string.getBytes(Charsets.UTF8), string2.getBytes(Charsets.UTF8)}), (boolean)true);
    }
}

