package com.keyware.shandan.system.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * <p>
 * OAUTH_CLIENT_DETAILS
 * </p>
 *
 * @author fengzhi
 * @since 2021-12-10
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName(value = "OAUTH_CLIENT_DETAILS", resultMap = "BaseResultMap")
public class OauthClientDetails implements Serializable {

    private static final long serialVersionUID = 2283589860793334842L;

    /**
     * 主键
     */
    @TableId(value = "CLIENT_ID", type = IdType.INPUT)
    private String id;

    @TableField("CLIENT_SECRET")
    private String clientSecret;

    @TableField("RESOURCE_IDS")
    private String resourceIds;

    @TableField(value = "SCOPE", whereStrategy = FieldStrategy.NEVER)
    private String scope = "all";

    @TableField(value = "AUTHORIZED_GRANT_TYPES", whereStrategy = FieldStrategy.NEVER)
    private String authorizedGrantTypes = "authorization_code,refresh_token";

    @TableField("WEB_SERVER_REDIRECT_URI")
    private String webServerRedirectUri;

    @TableField(value = "AUTHORITIES", whereStrategy = FieldStrategy.NEVER)
    private String authorities = "all";

    @TableField(value = "ACCESS_TOKEN_VALIDITY", whereStrategy = FieldStrategy.NEVER)
    private Long accessTokenValidity = 7200L;

    @TableField(value = "REFRESH_TOKEN_VALIDITY", whereStrategy = FieldStrategy.NEVER)
    private Long refreshTokenValidity = 7200L;

    @TableField("ADDITIONAL_INFORMATION")
    private String additionalInformation;

    @TableField(value = "AUTOAPPROVE", whereStrategy = FieldStrategy.NEVER)
    private String autoapprove = "true";

    @TableField("WEB_CLIENT_LOGOUT_URI")
    private String webClientLogoutUri;

    /**
     * 应用标题
     */
    @TableField(value = "TITLE", condition = SqlCondition.LIKE)
    private String title;

    /**
     * 应用打开方式
     */
    @TableField("TARGET")
    private String target;

    /**
     * 应用图标
     */
    @TableField("ICON")
    private String icon;

    /**
     * 应用排列顺序
     */
    @TableField("SORT")
    @OrderBy(isDesc = false)
    private String sort;

    /**
     * 是否开启用户数据同步
     */
    @TableField("USER_SYNC")
    private Boolean userSync;
    /**
     * 插入接口URI
     */
    @TableField("INSERT_URI")
    private String insertUri;
    /**
     * 更新接口URI
     */
    @TableField("UPDATE_URI")
    private String updateUri;
    /**
     * 删除接口URI
     */
    @TableField("DELETE_URI")
    private String deleteUri;
    /**
     * 验证URI
     */
    @TableField("VERIFY_URI")
    private String verifyUri;

    /**
     * 登出URI
     */
    @TableField("LOGOUT_URI")
    private String logoutUri;

    @Override
    public String toString() {
        return "OauthClientDetails{" +
                "id='" + id + '\'' +
                ", clientSecret='" + clientSecret + '\'' +
                ", resourceIds='" + resourceIds + '\'' +
                ", scope='" + scope + '\'' +
                ", authorizedGrantTypes='" + authorizedGrantTypes + '\'' +
                ", webServerRedirectUri='" + webServerRedirectUri + '\'' +
                ", authorities='" + authorities + '\'' +
                ", accessTokenValidity=" + accessTokenValidity +
                ", refreshTokenValidity=" + refreshTokenValidity +
                ", additionalInformation='" + additionalInformation + '\'' +
                ", autoapprove='" + autoapprove + '\'' +
                ", webClientLogoutUri='" + webClientLogoutUri + '\'' +
                ", title='" + title + '\'' +
                ", target='" + target + '\'' +
                ", icon='" + icon + '\'' +
                ", sort='" + sort + '\'' +
                '}';
    }
}
