import type { OIDCClient } from '@repo/oidc-provider';

// 示例客户端数据
const demoClients: OIDCClient[] = [
    {
        client_id: 'demo-client',
        client_secret: 'demo-client-secret',
        client_name: 'Demo Application',
        client_type: 'confidential',
        redirect_uris: [
            'http://localhost:3001/auth/callback',
            'http://localhost:8080/callback',
            'https://oauth.pstmn.io/v1/callback'
        ],
        grant_types: ['authorization_code', 'refresh_token'],
        response_types: ['code'],
        scopes: ['openid', 'profile', 'email'],
        token_endpoint_auth_method: 'client_secret_basic',
        created_at: new Date(),
        updated_at: new Date(),
    },
    {
        client_id: 'demo-public-client',
        client_name: 'Demo Public Application',
        client_type: 'public',
        redirect_uris: [
            'http://localhost:3000/callback',
            'myapp://callback'
        ],
        grant_types: ['authorization_code'],
        response_types: ['code'],
        scopes: ['openid', 'profile', 'email'],
        token_endpoint_auth_method: 'none',
        created_at: new Date(),
        updated_at: new Date(),
    }
];

// 查找客户端的函数
async function findClient(clientId: string): Promise<OIDCClient | null> {
    return demoClients.find(client => client.client_id === clientId) || null;
}

export const clients = {
    findClient,
    demoClients,
}; 