protected async Task <CostTemplateDetailsModel> CreateTrafficTemplate(CostUser user, CostType costType = CostType.Trafficking)
        {
            var model = new CreateCostTemplateModel
            {
                Name        = "costDetails",
                Type        = costType,
                CostDetails = new CostTemplateModel
                {
                    Name   = "costDetails",
                    Label  = "Cost Details",
                    Fields = new List <FormFieldDefintionModel>
                    {
                        new FormFieldDefintionModel
                        {
                            Label = "Agency Name",
                            Name  = "agencyName",
                            Type  = "string"
                        },
                        new FormFieldDefintionModel
                        {
                            Label = "Agency Location",
                            Name  = "agencyLocation",
                            Type  = "string"
                        },
                        new FormFieldDefintionModel
                        {
                            Label = "Agency producer/art buyer",
                            Name  = "agencyProducerArtBuyer",
                            Type  = "string"
                        },
                        new FormFieldDefintionModel
                        {
                            Label = "Budget Region",
                            Name  = "budgetRegion",
                            Type  = "string"
                        },
                        new FormFieldDefintionModel
                        {
                            Label = "Target Budget",
                            Name  = "targetBudget",
                            Type  = "string"
                        },
                        new FormFieldDefintionModel
                        {
                            Label = "Agency Tracking Number",
                            Name  = "contentType",
                            Type  = "string"
                        },
                        new FormFieldDefintionModel
                        {
                            Label = "Organisation",
                            Name  = "organisation",
                            Type  = "string"
                        },
                        new FormFieldDefintionModel
                        {
                            Label = "Agency Currency",
                            Name  = "agencyCurrency",
                            Type  = "string"
                        }
                    }
                },
                ProductionDetails =
                    new[]
                {
                    new ProductionDetailsTemplateModel
                    {
                        Type  = "Trafficking",
                        Forms = new List <ProductionDetailsFormDefinitionModel>
                        {
                            new ProductionDetailsFormDefinitionModel
                            {
                                Name   = "Trafficking",
                                Label  = "Trafficking",
                                Fields = new List <FormFieldDefintionModel>(),
                                CostLineItemSections = new List <CostLineItemSectionTemplateModel>
                                {
                                    new CostLineItemSectionTemplateModel
                                    {
                                        Name          = "distributionCosts",
                                        Label         = "Distribution",
                                        CurrencyLabel = "Trafficking Distribution Currency",
                                        Items         = new List <CostLineItemSectionTemplateItemModel>
                                        {
                                            new CostLineItemSectionTemplateItemModel
                                            {
                                                Label = "Trafficking/Distribution Costs",
                                                Name  = "distributionCosts"
                                            }
                                        }
                                    },
                                    new CostLineItemSectionTemplateModel
                                    {
                                        Name  = "OtherCosts",
                                        Label = "Other",
                                        Items = new List <CostLineItemSectionTemplateItemModel>
                                        {
                                            new CostLineItemSectionTemplateItemModel
                                            {
                                                Label = "Tax (if applicable)",
                                                Name  = "taxIfApplicable"
                                            },
                                            new CostLineItemSectionTemplateItemModel
                                            {
                                                Label    = "Technical Fee (when applicable)",
                                                Name     = "technicalFee",
                                                ReadOnly = true
                                            },
                                            new CostLineItemSectionTemplateItemModel
                                            {
                                                Label = "FX (Loss) and Gain",
                                                Name  = "foreignExchange"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
            };

            var result = await Browser.Post("/v1/costtemplate/create", with =>
            {
                with.User(user);
                with.JsonBody(model);
            });

            return(Deserialize <CostTemplateDetailsModel>(result, HttpStatusCode.Created));
        }
        protected async Task <CostTemplateDetailsModel> CreateTemplate(CostUser user, CostType costType = CostType.Production)
        {
            var model = new CreateCostTemplateModel
            {
                Name = "Production Cost",
                Type = costType,

                CostDetails = new CostTemplateModel
                {
                    Name   = "cost",
                    Label  = "Cost Details",
                    Fields = new List <FormFieldDefintionModel>
                    {
                        new FormFieldDefintionModel
                        {
                            Label = "Cost Number",
                            Name  = "costNumber",
                            Type  = "string"
                        }
                    }
                },
                Forms = new[]
                {
                    new FormDefinitionModel
                    {
                        Name   = "Test",
                        Label  = "test",
                        Fields = new List <FormFieldDefintionModel>
                        {
                            new FormFieldDefintionModel
                            {
                                Name  = "Test field one",
                                Label = "testFieldOne",
                                Type  = "string"
                            }
                        },
                        Sections = new List <FormSectionDefinitionModel>
                        {
                            new FormSectionDefinitionModel
                            {
                                Name   = "Section",
                                Label  = "section",
                                Fields = new List <FormFieldDefintionModel>
                                {
                                    new FormFieldDefintionModel
                                    {
                                        Name  = "Section one",
                                        Label = "sectionOne",
                                        Type  = "string"
                                    }
                                }
                            }
                        }
                    }
                },
                ProductionDetails =
                    new[]
                {
                    new ProductionDetailsTemplateModel
                    {
                        Type  = "video",
                        Forms = new List <ProductionDetailsFormDefinitionModel>
                        {
                            new ProductionDetailsFormDefinitionModel
                            {
                                Name   = "fullProductionWithShoot",
                                Label  = "Full Production",
                                Fields = new List <FormFieldDefintionModel>
                                {
                                    new FormFieldDefintionModel
                                    {
                                        Label = "Shoot Date",
                                        Name  = "shootDate",
                                        Type  = "string"
                                    }
                                },
                                CostLineItemSections = new List <CostLineItemSectionTemplateModel>
                                {
                                    new CostLineItemSectionTemplateModel
                                    {
                                        Name  = "production",
                                        Label = "Production",
                                        Items = new List <CostLineItemSectionTemplateItemModel>
                                        {
                                            new CostLineItemSectionTemplateItemModel
                                            {
                                                Label = "Art Department (Location /studio)",
                                                Name  = "artDepartmentStudio"
                                            },
                                            new CostLineItemSectionTemplateItemModel
                                            {
                                                Label = "Art Department (set dressing)",
                                                Name  = "artDepartmentSetDressing"
                                            },
                                            new CostLineItemSectionTemplateItemModel
                                            {
                                                Label = "Casting",
                                                Name  = "casting"
                                            },
                                            new CostLineItemSectionTemplateItemModel
                                            {
                                                Label = "Crew Costs",
                                                Name  = "crewCost"
                                            },
                                            new CostLineItemSectionTemplateItemModel
                                            {
                                                Label = "Equipment",
                                                Name  = "equiment"
                                            },
                                            new CostLineItemSectionTemplateItemModel
                                            {
                                                Label = "Photographer",
                                                Name  = "photographer"
                                            }
                                        }
                                    },
                                    new CostLineItemSectionTemplateModel
                                    {
                                        Name  = "postProduction",
                                        Label = "Post Production",
                                        Items = new List <CostLineItemSectionTemplateItemModel>
                                        {
                                            new CostLineItemSectionTemplateItemModel
                                            {
                                                Label = "Retouching",
                                                Name  = "retouching"
                                            }
                                        }
                                    },
                                    new CostLineItemSectionTemplateModel
                                    {
                                        Name  = "agencyCosts",
                                        Label = "Agency Costs",
                                        Items = new List <CostLineItemSectionTemplateItemModel>
                                        {
                                            new CostLineItemSectionTemplateItemModel
                                            {
                                                Label = "Foreign exchange loss/gain",
                                                Name  = "foreignExchangeLossGain"
                                            },
                                            new CostLineItemSectionTemplateItemModel
                                            {
                                                Label = "Insurance",
                                                Name  = "insurance"
                                            },
                                            new CostLineItemSectionTemplateItemModel
                                            {
                                                Label = "Offline costs",
                                                Name  = "offlineCosts"
                                            },
                                            new CostLineItemSectionTemplateItemModel
                                            {
                                                Label = "Online costs",
                                                Name  = "onlineCosts"
                                            },
                                            new CostLineItemSectionTemplateItemModel
                                            {
                                                Label = "Tax/importation tax",
                                                Name  = "taxImportationTax"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
            };

            var result = await Browser.Post("/v1/costtemplate/create", with =>
            {
                with.User(user);
                with.JsonBody(model);
            });

            return(Deserialize <CostTemplateDetailsModel>(result, HttpStatusCode.Created));
        }
            protected CreateCostTemplateModel GetCreateCostTemplateModel()
            {
                var model = new CreateCostTemplateModel
                {
                    Name        = "Production Cost",
                    CostDetails = new CostTemplateModel
                    {
                        Name   = "cost",
                        Label  = "Cost Details",
                        Fields = new List <FormFieldDefintionModel>
                        {
                            new FormFieldDefintionModel
                            {
                                Label = "Cost Number",
                                Name  = "costNumber",
                                Type  = "string"
                            }
                        }
                    },
                    ProductionDetails =
                        new[]
                    {
                        new ProductionDetailsTemplateModel
                        {
                            Type  = "video",
                            Forms = new List <ProductionDetailsFormDefinitionModel>
                            {
                                new ProductionDetailsFormDefinitionModel
                                {
                                    Name   = "fullProductionWithShoot",
                                    Label  = "Full Production",
                                    Fields = new List <FormFieldDefintionModel>
                                    {
                                        new FormFieldDefintionModel
                                        {
                                            Label = "Shoot Date",
                                            Name  = "shootDate",
                                            Type  = "string"
                                        }
                                    },
                                    CostLineItemSections = new List <CostLineItemSectionTemplateModel>
                                    {
                                        new CostLineItemSectionTemplateModel
                                        {
                                            Name  = "production",
                                            Label = "Production",
                                            Items = new List <CostLineItemSectionTemplateItemModel>
                                            {
                                                new CostLineItemSectionTemplateItemModel
                                                {
                                                    Label = "Art Department (Location /studio)",
                                                    Name  = "artDepartmentStudio"
                                                },
                                                new CostLineItemSectionTemplateItemModel
                                                {
                                                    Label = "Art Department (set dressing)",
                                                    Name  = "artDepartmentSetDressing"
                                                },
                                                new CostLineItemSectionTemplateItemModel
                                                {
                                                    Label = "Casting",
                                                    Name  = "casting"
                                                },
                                                new CostLineItemSectionTemplateItemModel
                                                {
                                                    Label = "Crew costs",
                                                    Name  = "crewCost"
                                                },
                                                new CostLineItemSectionTemplateItemModel
                                                {
                                                    Label = "Equipment",
                                                    Name  = "equiment"
                                                },
                                                new CostLineItemSectionTemplateItemModel
                                                {
                                                    Label = "Photographer",
                                                    Name  = "photographer"
                                                }
                                            }
                                        },
                                        new CostLineItemSectionTemplateModel
                                        {
                                            Name  = "postProduction",
                                            Label = "Post Production",
                                            Items = new List <CostLineItemSectionTemplateItemModel>
                                            {
                                                new CostLineItemSectionTemplateItemModel
                                                {
                                                    Label = "Retouching",
                                                    Name  = "retouching"
                                                }
                                            }
                                        },
                                        new CostLineItemSectionTemplateModel
                                        {
                                            Name  = "agencyCosts",
                                            Label = "Agency Costs",
                                            Items = new List <CostLineItemSectionTemplateItemModel>
                                            {
                                                new CostLineItemSectionTemplateItemModel
                                                {
                                                    Label = "Foreign exchange loss/gain",
                                                    Name  = "foreignExchangeLossGain"
                                                },
                                                new CostLineItemSectionTemplateItemModel
                                                {
                                                    Label = "Insurance",
                                                    Name  = "insurance"
                                                },
                                                new CostLineItemSectionTemplateItemModel
                                                {
                                                    Label = "Offline costs",
                                                    Name  = "offlineCosts"
                                                },
                                                new CostLineItemSectionTemplateItemModel
                                                {
                                                    Label = "Online costs",
                                                    Name  = "offlineCosts"
                                                },
                                                new CostLineItemSectionTemplateItemModel
                                                {
                                                    Label = "Tax/importation tax",
                                                    Name  = "taxImportationTax"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                };

                return(model);
            }