// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.

package armbillingtrust_test

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billingtrust/armbillingtrust"
	"log"
)

// Generated from example definition: 2026-03-17-preview/Assessments_CreateOrUpdate.json
func ExampleAssessmentsClient_BeginCreateOrUpdate_createOrUpdateTheEduAssessmentForAnEnrollment() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armbillingtrust.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewAssessmentsClient().BeginCreateOrUpdate(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/billing-edu-rg/providers/Microsoft.Program/educationEnrollments/default", armbillingtrust.Assessment{
		Properties: &armbillingtrust.AssessmentProperties{
			AssessmentType: to.Ptr(armbillingtrust.AssessmentTypeEdu),
			InitialValues: []armbillingtrust.InitialRuleValueBaseClassification{
				&armbillingtrust.EduInitialValue{
					Kind: to.Ptr(armbillingtrust.RuleKindEduQualification),
					Domains: []*armbillingtrust.DomainEntry{
						{
							DomainNames: []*string{
								to.Ptr("students.contoso.edu"),
								to.Ptr("faculty.contoso.edu"),
							},
							TenantID: to.Ptr("11111111-1111-1111-1111-111111111111"),
						},
					},
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to poll the result: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armbillingtrust.AssessmentsClientCreateOrUpdateResponse{
	// 	Assessment: armbillingtrust.Assessment{
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/billing-edu-rg/providers/Microsoft.Program/educationEnrollments/default/providers/Microsoft.BillingTrust/assessments/default"),
	// 		Name: to.Ptr("default"),
	// 		Type: to.Ptr("Microsoft.BillingTrust/assessments"),
	// 		Properties: &armbillingtrust.AssessmentProperties{
	// 			AssessmentType: to.Ptr(armbillingtrust.AssessmentTypeEdu),
	// 			EvaluationState: to.Ptr(armbillingtrust.AssessmentStatePending),
	// 			ProvisioningState: to.Ptr(armbillingtrust.ProvisioningStateAccepted),
	// 		},
	// 		SystemData: &armbillingtrust.SystemData{
	// 			CreatedBy: to.Ptr("edu-admin@contoso.com"),
	// 			CreatedByType: to.Ptr(armbillingtrust.CreatedByTypeUser),
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-17T10:00:00.000Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("edu-admin@contoso.com"),
	// 			LastModifiedByType: to.Ptr(armbillingtrust.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-17T10:00:00.000Z"); return t}()),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-03-17-preview/Assessments_CreateOrUpdate_BV.json
func ExampleAssessmentsClient_BeginCreateOrUpdate_createOrUpdateTheBusinessVerificationAssessmentForABillingAccount() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armbillingtrust.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewAssessmentsClient().BeginCreateOrUpdate(ctx, "providers/Microsoft.Billing/billingAccounts/abc123:00000000-0000-0000-0000-000000000000_2019-05-31", armbillingtrust.Assessment{
		Properties: &armbillingtrust.AssessmentProperties{
			AssessmentType: to.Ptr(armbillingtrust.AssessmentTypeBusinessVerification),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to poll the result: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armbillingtrust.AssessmentsClientCreateOrUpdateResponse{
	// 	Assessment: armbillingtrust.Assessment{
	// 		ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/abc123:00000000-0000-0000-0000-000000000000_2019-05-31/providers/Microsoft.BillingTrust/assessments/default"),
	// 		Name: to.Ptr("default"),
	// 		Type: to.Ptr("Microsoft.BillingTrust/assessments"),
	// 		Properties: &armbillingtrust.AssessmentProperties{
	// 			AssessmentType: to.Ptr(armbillingtrust.AssessmentTypeBusinessVerification),
	// 			EvaluationState: to.Ptr(armbillingtrust.AssessmentStatePending),
	// 			ProvisioningState: to.Ptr(armbillingtrust.ProvisioningStateAccepted),
	// 		},
	// 		SystemData: &armbillingtrust.SystemData{
	// 			CreatedBy: to.Ptr("billing-admin@contoso.com"),
	// 			CreatedByType: to.Ptr(armbillingtrust.CreatedByTypeUser),
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-17T10:00:00.000Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("billing-admin@contoso.com"),
	// 			LastModifiedByType: to.Ptr(armbillingtrust.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-17T10:00:00.000Z"); return t}()),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-03-17-preview/Assessments_CreateOrUpdate_PayeeEnrollment.json
func ExampleAssessmentsClient_BeginCreateOrUpdate_createOrUpdateThePayeeEnrollmentAssessmentForABillingAccount() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armbillingtrust.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewAssessmentsClient().BeginCreateOrUpdate(ctx, "providers/Microsoft.Billing/billingAccounts/abc123:00000000-0000-0000-0000-000000000000_2019-05-31", armbillingtrust.Assessment{
		Properties: &armbillingtrust.AssessmentProperties{
			AssessmentType: to.Ptr(armbillingtrust.AssessmentTypePayeeEnrollment),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to poll the result: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armbillingtrust.AssessmentsClientCreateOrUpdateResponse{
	// 	Assessment: armbillingtrust.Assessment{
	// 		ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/abc123:00000000-0000-0000-0000-000000000000_2019-05-31/providers/Microsoft.BillingTrust/assessments/default"),
	// 		Name: to.Ptr("default"),
	// 		Type: to.Ptr("Microsoft.BillingTrust/assessments"),
	// 		Properties: &armbillingtrust.AssessmentProperties{
	// 			AssessmentType: to.Ptr(armbillingtrust.AssessmentTypePayeeEnrollment),
	// 			EvaluationState: to.Ptr(armbillingtrust.AssessmentStatePending),
	// 			ProvisioningState: to.Ptr(armbillingtrust.ProvisioningStateAccepted),
	// 		},
	// 		SystemData: &armbillingtrust.SystemData{
	// 			CreatedBy: to.Ptr("billing-admin@contoso.com"),
	// 			CreatedByType: to.Ptr(armbillingtrust.CreatedByTypeUser),
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-17T10:00:00.000Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("billing-admin@contoso.com"),
	// 			LastModifiedByType: to.Ptr(armbillingtrust.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-17T10:00:00.000Z"); return t}()),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-03-17-preview/Assessments_CreateOrUpdate_PayeeProfile.json
func ExampleAssessmentsClient_BeginCreateOrUpdate_createOrUpdateThePayeeProfileAssessmentForABillingAccount() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armbillingtrust.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewAssessmentsClient().BeginCreateOrUpdate(ctx, "providers/Microsoft.Billing/billingAccounts/abc123:00000000-0000-0000-0000-000000000000_2019-05-31", armbillingtrust.Assessment{
		Properties: &armbillingtrust.AssessmentProperties{
			AssessmentType: to.Ptr(armbillingtrust.AssessmentTypePayeeProfile),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to poll the result: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armbillingtrust.AssessmentsClientCreateOrUpdateResponse{
	// 	Assessment: armbillingtrust.Assessment{
	// 		ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/abc123:00000000-0000-0000-0000-000000000000_2019-05-31/providers/Microsoft.BillingTrust/assessments/default"),
	// 		Name: to.Ptr("default"),
	// 		Type: to.Ptr("Microsoft.BillingTrust/assessments"),
	// 		Properties: &armbillingtrust.AssessmentProperties{
	// 			AssessmentType: to.Ptr(armbillingtrust.AssessmentTypePayeeProfile),
	// 			EvaluationState: to.Ptr(armbillingtrust.AssessmentStatePending),
	// 			ProvisioningState: to.Ptr(armbillingtrust.ProvisioningStateAccepted),
	// 		},
	// 		SystemData: &armbillingtrust.SystemData{
	// 			CreatedBy: to.Ptr("billing-admin@contoso.com"),
	// 			CreatedByType: to.Ptr(armbillingtrust.CreatedByTypeUser),
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-17T10:00:00.000Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("billing-admin@contoso.com"),
	// 			LastModifiedByType: to.Ptr(armbillingtrust.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-17T10:00:00.000Z"); return t}()),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-03-17-preview/Assessments_Delete.json
func ExampleAssessmentsClient_BeginDelete() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armbillingtrust.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewAssessmentsClient().BeginDelete(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/billing-edu-rg/providers/Microsoft.Program/educationEnrollments/default", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to poll the result: %v", err)
	}
}

// Generated from example definition: 2026-03-17-preview/Assessments_Get.json
func ExampleAssessmentsClient_Get() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armbillingtrust.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAssessmentsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/billing-edu-rg/providers/Microsoft.Program/educationEnrollments/default", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armbillingtrust.AssessmentsClientGetResponse{
	// 	Assessment: armbillingtrust.Assessment{
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/billing-edu-rg/providers/Microsoft.Program/educationEnrollments/default/providers/Microsoft.BillingTrust/assessments/default"),
	// 		Name: to.Ptr("default"),
	// 		Type: to.Ptr("Microsoft.BillingTrust/assessments"),
	// 		Properties: &armbillingtrust.AssessmentProperties{
	// 			AssessmentType: to.Ptr(armbillingtrust.AssessmentTypeEdu),
	// 			EvaluationState: to.Ptr(armbillingtrust.AssessmentStateSucceeded),
	// 			ProvisioningState: to.Ptr(armbillingtrust.ProvisioningStateSucceeded),
	// 		},
	// 		SystemData: &armbillingtrust.SystemData{
	// 			CreatedBy: to.Ptr("edu-admin@contoso.com"),
	// 			CreatedByType: to.Ptr(armbillingtrust.CreatedByTypeUser),
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-17T10:00:00.000Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("edu-admin@contoso.com"),
	// 			LastModifiedByType: to.Ptr(armbillingtrust.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-17T10:15:00.000Z"); return t}()),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-03-17-preview/Assessments_List.json
func ExampleAssessmentsClient_NewListPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armbillingtrust.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewAssessmentsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/billing-edu-rg/providers/Microsoft.Program/educationEnrollments/default", nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page = armbillingtrust.AssessmentsClientListResponse{
		// 	AssessmentListResult: armbillingtrust.AssessmentListResult{
		// 		Value: []*armbillingtrust.Assessment{
		// 			{
		// 				ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/billing-edu-rg/providers/Microsoft.Program/educationEnrollments/default/providers/Microsoft.BillingTrust/assessments/default"),
		// 				Name: to.Ptr("default"),
		// 				Type: to.Ptr("Microsoft.BillingTrust/assessments"),
		// 				Properties: &armbillingtrust.AssessmentProperties{
		// 					AssessmentType: to.Ptr(armbillingtrust.AssessmentTypeEdu),
		// 					EvaluationState: to.Ptr(armbillingtrust.AssessmentStateSucceeded),
		// 					ProvisioningState: to.Ptr(armbillingtrust.ProvisioningStateSucceeded),
		// 				},
		// 				SystemData: &armbillingtrust.SystemData{
		// 					CreatedBy: to.Ptr("edu-admin@contoso.com"),
		// 					CreatedByType: to.Ptr(armbillingtrust.CreatedByTypeUser),
		// 					CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-17T10:00:00.000Z"); return t}()),
		// 					LastModifiedBy: to.Ptr("edu-admin@contoso.com"),
		// 					LastModifiedByType: to.Ptr(armbillingtrust.CreatedByTypeUser),
		// 					LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-17T10:15:00.000Z"); return t}()),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

// Generated from example definition: 2026-03-17-preview/Assessments_ListUploadToken.json
func ExampleAssessmentsClient_ListUploadToken() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armbillingtrust.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAssessmentsClient().ListUploadToken(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/billing-edu-rg/providers/Microsoft.Program/educationEnrollments/default", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armbillingtrust.AssessmentsClientListUploadTokenResponse{
	// 	GenerateUploadTokenResponse: armbillingtrust.GenerateUploadTokenResponse{
	// 		Token: to.Ptr("{upload-token}"),
	// 	},
	// }
}
