import { ICredentialType, INodeProperties } from 'n8n-workflow';
import { BASE_API_URL } from '../nodes/RdsmEcommerce/Utils/GenericConstants';

export class RdsmEcommerceOAuth2Api implements ICredentialType {
	name = 'rdsmEcommerceOAuth2Api';
	extends = ['oAuth2Api'];
	// eslint-disable-next-line n8n-nodes-base/cred-class-field-display-name-miscased
	displayName = 'RD Station Marketing para Ecommerce OAuth2 API';
	description = 'Authentication OAuth2 to RD Station Marketing';
	documentationUrl = 'https://developers.rdstation.com/reference/introducao-rdsm';

	properties: INodeProperties[] = [
		{
			displayName: 'Grant Type',
			name: 'grantType',
			type: 'hidden',
			default: 'authorizationCode',
		},
		{
			displayName: 'Authorization URL',
			name: 'authUrl',
			type: 'hidden',
			default: `${BASE_API_URL}/auth/dialog`
		},
		{
			displayName: 'Access Token URL',
			name: 'accessTokenUrl',
			type: 'hidden',
			default: `${BASE_API_URL}/auth/token`
		},
		{
			displayName: 'Scope',
			name: 'scope',
			type: 'hidden',
			default: '',
		},
		{
			displayName: 'Auth URI Query Parameters',
			name: 'authQueryParameters',
			type: 'hidden',
			default: '',
		},
		{
			displayName: 'Authentication',
			name: 'authentication',
			type: 'hidden',
			default: 'body',
		},
	];
}
