/**
         * This scenario demonstrates the creation of a document
         * that needs to be signed using the XAdES format for a
         * specific XML element.
         */
        public override async Task RunAsync()
        {
            // 1. The file's bytes must be read by the application and uploaded
            var filePath    = "sample.xml";
            var fileName    = Path.GetFileName(filePath);
            var file        = File.ReadAllBytes(filePath);
            var uploadModel = await SignerClient.UploadFileAsync(fileName, file, "application/xml");

            // 2. Define the name of the document which will be visible in the application
            var fileUploadModel = new FileUploadModel(uploadModel)
            {
                DisplayName = "XML Element Sign Sample"
            };

            // 3. For each participant on the flow, create one instance of ParticipantUserModel
            var participantUser = new ParticipantUserModel()
            {
                Name       = "Jack Bauer",
                Email      = "*****@*****.**",
                Identifier = "75502846369"
            };

            // 4. Specify the type of the element (Id is used below) and the value of the identifier
            var xadesOptionsModel = new XadesOptionsModel()
            {
                SignatureType = XadesSignatureTypes.XmlElement,
                ElementToSignIdentifierType = XadesElementIdentifierTypes.Id,
                ElementToSignIdentifier     = "NFe35141214314050000662550010001084271182362300"
            };

            // 5. Create a FlowActionCreateModel instance for each action (signature or approval) in the flow.
            //    This object is responsible for defining the personal data of the participant and the type of
            //    action that he will perform on the flow.
            var flowActionCreateModel = new FlowActionCreateModel()
            {
                Type         = FlowActionType.Signer,
                User         = participantUser,
                XadesOptions = xadesOptionsModel
            };

            // 6. Send the document create request
            var documentRequest = new CreateDocumentRequest()
            {
                Files = new List <FileUploadModel>()
                {
                    fileUploadModel
                },
                FlowActions = new List <FlowActionCreateModel>()
                {
                    flowActionCreateModel
                }
            };
            var result = (await SignerClient.CreateDocumentAsync(documentRequest)).First();

            System.Console.WriteLine($"Document {result.DocumentId} created");
        }
        /**
         * This scenario demonstrates the creation of a digital degree compliant with "PORTARIA Nº 554, DE 11 DE MARÇO DE 2019".
         */
        public override async Task RunAsync()
        {
            // 1. The file's bytes must be read by the application and uploaded
            var filePath    = "sample-degree.xml";
            var fileName    = Path.GetFileName(filePath);
            var file        = File.ReadAllBytes(filePath);
            var uploadModel = await SignerClient.UploadFileAsync(fileName, file, "application/xml");

            // 2. Define the name of the document which will be visible in the application
            var fileUploadModel = new FileUploadModel(uploadModel)
            {
                DisplayName = "Digital Degree Sample"
            };

            // 3. For each participant on the flow, create one instance of ParticipantUserModel
            var participantUserOne = new ParticipantUserModel()
            {
                Name       = "Jack Bauer",
                Email      = "*****@*****.**",
                Identifier = "75502846369"
            };

            var participantUserTwo = new ParticipantUserModel()
            {
                Name       = "James Bond",
                Email      = "*****@*****.**",
                Identifier = "95588148061"
            };

            var ParticipantUserThree = new ParticipantUserModel()
            {
                Name       = "Gary Eggsy",
                Email      = "*****@*****.**",
                Identifier = "87657257008"
            };

            // 4. Specify the element that holds the namespace of the issuer
            var xmlNamespacesModel = new XmlNamespaceModel()
            {
                Prefix = "dip",
                Uri    = @"http://portal.mec.gov.br/diplomadigital/arquivos-em-xsd"
            };

            // 5. The fields 'DadosDiploma' and 'DadosRegistro' and the entire XML file must be signed
            var xadesOptionsDegreeData = new XadesOptionsModel()
            {
                SignatureType = XadesSignatureTypes.XmlElement,
                ElementToSignIdentifierType = XadesElementIdentifierTypes.XPath,
                ElementToSignIdentifier     = @"//dip:DadosDiploma",
                InsertionOption             = XadesInsertionOptions.AppendChild
            };

            var xadesOptionsModelRegisterData = new XadesOptionsModel()
            {
                SignatureType = XadesSignatureTypes.XmlElement,
                ElementToSignIdentifierType = XadesElementIdentifierTypes.XPath,
                ElementToSignIdentifier     = @"//dip:DadosRegistro",
                InsertionOption             = XadesInsertionOptions.AppendChild
            };

            var xadesOptionsModelFull = new XadesOptionsModel()
            {
                SignatureType = XadesSignatureTypes.FullXml
            };

            // 6. Each signature requires its own flow action
            var degreeDataAction = new FlowActionCreateModel()
            {
                Type         = FlowActionType.Signer,
                User         = participantUserOne,
                XadesOptions = xadesOptionsDegreeData
            };

            var registerDataAction = new FlowActionCreateModel()
            {
                Type         = FlowActionType.Signer,
                User         = participantUserTwo,
                XadesOptions = xadesOptionsModelRegisterData
            };

            var flowActionCreateModelFull = new FlowActionCreateModel()
            {
                Type         = FlowActionType.Signer,
                User         = ParticipantUserThree,
                XadesOptions = xadesOptionsModelFull
            };

            // 7. Send the document create request
            var documentRequest = new CreateDocumentRequest()
            {
                Files = new List <FileUploadModel>()
                {
                    fileUploadModel
                },
                XmlNamespaces = new List <XmlNamespaceModel>()
                {
                    xmlNamespacesModel
                },
                FlowActions = new List <FlowActionCreateModel>()
                {
                    degreeDataAction,
                    registerDataAction,
                    flowActionCreateModelFull
                },
            };
            var result = (await SignerClient.CreateDocumentAsync(documentRequest)).First();

            System.Console.WriteLine($"Document {result.DocumentId} created");
        }