From c3fe4349ec90f5ed9ef78095fdc51bd25eae93ad Mon Sep 17 00:00:00 2001
From: Carlos Treminio <ctreminiom079@gmail.com>
Date: Fri, 28 Apr 2023 17:37:02 -0600
Subject: [PATCH] :building_construction: Moved the Notification Scheme to
 their own dedicated service.

1. The notification schemes can be linked with a project, but there are no exclusivity related to the project.
2. Hence, the service was moved under the root library and not under the project service.
---
 jira/internal/project_impl.go | 21 ++++++-------
 jira/v2/api_client_impl.go    | 57 ++++++++++++++++++-----------------
 jira/v3/api_client_impl.go    | 57 ++++++++++++++++++-----------------
 3 files changed, 67 insertions(+), 68 deletions(-)

diff --git a/jira/internal/project_impl.go b/jira/internal/project_impl.go
index 6148f7a8..c873db60 100644
--- a/jira/internal/project_impl.go
+++ b/jira/internal/project_impl.go
@@ -13,16 +13,15 @@ import (
 )
 
 type ProjectChildServices struct {
-	Category     *ProjectCategoryService
-	Component    *ProjectComponentService
-	Feature      *ProjectFeatureService
-	Permission   *ProjectPermissionSchemeService
-	Notification *NotificationSchemeService
-	Property     *ProjectPropertyService
-	Role         *ProjectRoleService
-	Type         *ProjectTypeService
-	Validator    *ProjectValidatorService
-	Version      *ProjectVersionService
+	Category   *ProjectCategoryService
+	Component  *ProjectComponentService
+	Feature    *ProjectFeatureService
+	Permission *ProjectPermissionSchemeService
+	Property   *ProjectPropertyService
+	Role       *ProjectRoleService
+	Type       *ProjectTypeService
+	Validator  *ProjectValidatorService
+	Version    *ProjectVersionService
 }
 
 func NewProjectService(client service.Client, version string, subServices *ProjectChildServices) (*ProjectService, error) {
@@ -42,7 +41,6 @@ func NewProjectService(client service.Client, version string, subServices *Proje
 		Type:           subServices.Type,
 		Validator:      subServices.Validator,
 		Version:        subServices.Version,
-		Notification:   subServices.Notification,
 	}, nil
 }
 
@@ -57,7 +55,6 @@ type ProjectService struct {
 	Type           *ProjectTypeService
 	Validator      *ProjectValidatorService
 	Version        *ProjectVersionService
-	Notification   *NotificationSchemeService
 }
 
 // Create creates a project based on a project type template
diff --git a/jira/v2/api_client_impl.go b/jira/v2/api_client_impl.go
index 757f3314..4e9f0f28 100644
--- a/jira/v2/api_client_impl.go
+++ b/jira/v2/api_client_impl.go
@@ -276,16 +276,15 @@ func New(httpClient common.HttpClient, site string) (*Client, error) {
 	}
 
 	projectSubService := &internal.ProjectChildServices{
-		Category:     projectCategory,
-		Component:    projectComponent,
-		Feature:      projectFeature,
-		Permission:   projectPermission,
-		Property:     projectProperties,
-		Role:         projectRole,
-		Type:         projectType,
-		Validator:    projectValidator,
-		Version:      projectVersion,
-		Notification: projectNotificationScheme,
+		Category:   projectCategory,
+		Component:  projectComponent,
+		Feature:    projectFeature,
+		Permission: projectPermission,
+		Property:   projectProperties,
+		Role:       projectRole,
+		Type:       projectType,
+		Validator:  projectValidator,
+		Version:    projectVersion,
 	}
 
 	project, err := internal.NewProjectService(client, "2", projectSubService)
@@ -369,29 +368,31 @@ func New(httpClient common.HttpClient, site string) (*Client, error) {
 	client.User = user
 	client.Workflow = workflow
 	client.JQL = jql
+	client.NotificationScheme = projectNotificationScheme
 
 	return client, nil
 }
 
 type Client struct {
-	HTTP       common.HttpClient
-	Auth       common.Authentication
-	Site       *url.URL
-	Role       *internal.ApplicationRoleService
-	Audit      *internal.AuditRecordService
-	Dashboard  *internal.DashboardService
-	Filter     *internal.FilterService
-	Group      *internal.GroupService
-	Issue      *internal.IssueRichTextService
-	MySelf     *internal.MySelfService
-	Permission *internal.PermissionService
-	Project    *internal.ProjectService
-	Screen     *internal.ScreenService
-	Task       *internal.TaskService
-	Server     *internal.ServerService
-	User       *internal.UserService
-	Workflow   *internal.WorkflowService
-	JQL        *internal.JQLService
+	HTTP               common.HttpClient
+	Auth               common.Authentication
+	Site               *url.URL
+	Role               *internal.ApplicationRoleService
+	Audit              *internal.AuditRecordService
+	Dashboard          *internal.DashboardService
+	Filter             *internal.FilterService
+	Group              *internal.GroupService
+	Issue              *internal.IssueRichTextService
+	MySelf             *internal.MySelfService
+	Permission         *internal.PermissionService
+	Project            *internal.ProjectService
+	Screen             *internal.ScreenService
+	Task               *internal.TaskService
+	Server             *internal.ServerService
+	User               *internal.UserService
+	Workflow           *internal.WorkflowService
+	JQL                *internal.JQLService
+	NotificationScheme *internal.NotificationSchemeService
 }
 
 func (c *Client) NewFormRequest(ctx context.Context, method, apiEndpoint, contentType string, payload io.Reader) (*http.Request, error) {
diff --git a/jira/v3/api_client_impl.go b/jira/v3/api_client_impl.go
index 54cc1cf6..e2acf35b 100644
--- a/jira/v3/api_client_impl.go
+++ b/jira/v3/api_client_impl.go
@@ -276,16 +276,15 @@ func New(httpClient common.HttpClient, site string) (*Client, error) {
 	}
 
 	projectSubService := &internal.ProjectChildServices{
-		Category:     projectCategory,
-		Component:    projectComponent,
-		Feature:      projectFeature,
-		Permission:   projectPermission,
-		Property:     projectProperties,
-		Role:         projectRole,
-		Type:         projectType,
-		Validator:    projectValidator,
-		Version:      projectVersion,
-		Notification: projectNotificationScheme,
+		Category:   projectCategory,
+		Component:  projectComponent,
+		Feature:    projectFeature,
+		Permission: projectPermission,
+		Property:   projectProperties,
+		Role:       projectRole,
+		Type:       projectType,
+		Validator:  projectValidator,
+		Version:    projectVersion,
 	}
 
 	project, err := internal.NewProjectService(client, "3", projectSubService)
@@ -369,29 +368,31 @@ func New(httpClient common.HttpClient, site string) (*Client, error) {
 	client.User = user
 	client.Workflow = workflow
 	client.JQL = jql
+	client.NotificationScheme = projectNotificationScheme
 
 	return client, nil
 }
 
 type Client struct {
-	HTTP       common.HttpClient
-	Auth       common.Authentication
-	Site       *url.URL
-	Audit      *internal.AuditRecordService
-	Role       *internal.ApplicationRoleService
-	Dashboard  *internal.DashboardService
-	Filter     *internal.FilterService
-	Group      *internal.GroupService
-	Issue      *internal.IssueADFService
-	MySelf     *internal.MySelfService
-	Permission *internal.PermissionService
-	Project    *internal.ProjectService
-	Screen     *internal.ScreenService
-	Task       *internal.TaskService
-	Server     *internal.ServerService
-	User       *internal.UserService
-	Workflow   *internal.WorkflowService
-	JQL        *internal.JQLService
+	HTTP               common.HttpClient
+	Auth               common.Authentication
+	Site               *url.URL
+	Audit              *internal.AuditRecordService
+	Role               *internal.ApplicationRoleService
+	Dashboard          *internal.DashboardService
+	Filter             *internal.FilterService
+	Group              *internal.GroupService
+	Issue              *internal.IssueADFService
+	MySelf             *internal.MySelfService
+	Permission         *internal.PermissionService
+	Project            *internal.ProjectService
+	Screen             *internal.ScreenService
+	Task               *internal.TaskService
+	Server             *internal.ServerService
+	User               *internal.UserService
+	Workflow           *internal.WorkflowService
+	JQL                *internal.JQLService
+	NotificationScheme *internal.NotificationSchemeService
 }
 
 func (c *Client) NewFormRequest(ctx context.Context, method, apiEndpoint, contentType string, payload io.Reader) (*http.Request, error) {