/* Options:
Date: 2025-04-15 04:58:36
Version: 8.23
Tip: To override a DTO option, remove "//" prefix before updating
BaseUrl: https://testapi.bokamera.se

//GlobalNamespace: 
//MakePartial: True
//MakeVirtual: True
//MakeInternal: False
//MakeDataContractsExtensible: False
//AddNullableAnnotations: False
//AddReturnMarker: True
//AddDescriptionAsComments: True
//AddDataContractAttributes: False
//AddIndexesToDataMembers: False
//AddGeneratedCodeAttributes: False
//AddResponseStatus: False
//AddImplicitVersion: 
//InitializeCollections: True
//ExportValueTypes: False
IncludeTypes: CustomerQuery.*
//ExcludeTypes: 
//AddNamespaces: 
//AddDefaultXmlNamespace: http://schemas.servicestack.net/types
*/

using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using System.Globalization;
using ServiceStack.Data;
using System.IO;
using System.Net;
using System.Net.Http.Headers;
using BokaMera.API.ServiceModel.Db;
using BokaMera.API.ServiceModel.Dtos;
using PaysonIntegrationCO2.Models;

namespace BokaMera.API.ServiceModel.Db
{
    public partial class BaseModel
    {
    }

    public partial class Customer
        : BaseModel, IUser, ICustomFieldTable
    {
        public virtual int IdentityId { get; set; }
        public virtual Guid Id { get; set; }
        [Ignore]
        public virtual Guid CustomerId { get; set; }

        [Ignore]
        public virtual IList<UserAccessKeys> AccessKeys { get; set; }

        public virtual string Email { get; set; }
        [Ignore]
        public virtual IList<ExternalReference> ExternalReferences { get; set; }

        [Ignore]
        public virtual Company Company { get; set; }

        [Ignore]
        public virtual IList<CustomFieldConfig> CustomFieldsConfig { get; set; }

        [Ignore]
        public virtual IList<CustomFieldDataResponse> CustomFieldsData { get; set; }

        [Ignore]
        public virtual IList<CustomerComment> Comments { get; set; }

        [Ignore]
        public virtual IList<RebateCode> RebateCodes { get; set; }

        public virtual string Firstname { get; set; }
        [Ignore]
        public virtual string FullName { get; set; }

        [Ignore]
        public virtual string ImageUrl { get; set; }

        [Required]
        public virtual bool Active { get; set; }

        public virtual string FacebookUsername { get; set; }
        [Required]
        public virtual DateTime Updated { get; set; }

        [Required]
        public virtual DateTime Created { get; set; }

        public virtual string IpAddress { get; set; }
        public virtual DateTimeOffset? ModifiedDate { get; set; }
        public virtual string TextField1 { get; set; }
        public virtual string TextField2 { get; set; }
        public virtual string TextField3 { get; set; }
        public virtual string TextField4 { get; set; }
        public virtual string TextField5 { get; set; }
        public virtual string TextField6 { get; set; }
        public virtual string TextField7 { get; set; }
        public virtual string TextField8 { get; set; }
        public virtual string TextField9 { get; set; }
        public virtual string TextField10 { get; set; }
        public virtual string TextField11 { get; set; }
        public virtual string TextField12 { get; set; }
        public virtual string TextField13 { get; set; }
        public virtual string TextField14 { get; set; }
        public virtual string TextField15 { get; set; }
        public virtual string TextField16 { get; set; }
        public virtual string TextField17 { get; set; }
        public virtual string TextField18 { get; set; }
        public virtual string TextField19 { get; set; }
        public virtual string TextField20 { get; set; }
        public virtual Guid UserId { get; set; }
        public virtual string Lastname { get; set; }
        public virtual string Phone { get; set; }
        public virtual string CorporateIdentityNumber { get; set; }
        public virtual string InvoiceAddress1 { get; set; }
        public virtual string InvoiceAddress2 { get; set; }
        public virtual string InvoiceCity { get; set; }
        public virtual string InvoicePostalCode { get; set; }
        public virtual string InvoiceCountryCode { get; set; }
        [Required]
        public virtual Guid CompanyId { get; set; }

        public virtual bool SubscribedToNewsletter { get; set; }
    }

    public partial class UserAccessKeys
        : BaseModel
    {
        [Required]
        public virtual Guid CompanyId { get; set; }

        [Required]
        public virtual int AccessKeyTypeId { get; set; }

        [Required]
        public virtual string Value { get; set; }

        [Required]
        public virtual Guid CustomerId { get; set; }

        public virtual string Description { get; set; }
        [Required]
        public virtual Guid Id { get; set; }
    }

}

namespace BokaMera.API.ServiceModel.Dtos
{
    public partial class CustomerCommentsResponse
    {
        public virtual int Id { get; set; }
        public virtual Guid CustomerId { get; set; }
        public virtual string Comments { get; set; }
        public virtual DateTime Updated { get; set; }
        public virtual DateTime Created { get; set; }
        public virtual Uri ImageUrl { get; set; }
    }

    [Route("/customers", "GET")]
    [ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)]
    [ValidateRequest("IsAuthenticated")]
    public partial class CustomerQuery
        : QueryDb<Customer, CustomerQueryResponse>, IReturn<QueryResponse<CustomerQueryResponse>>
    {
        ///<summary>
        ///Enter the company and id you want to see the information for a customer, if blank company id and you are an admin, your company id will be used. If blank id, all resources will be shown 
        ///</summary>
        [ApiMember(Description="Enter the company and id you want to see the information for a customer, if blank company id and you are an admin, your company id will be used. If blank id, all resources will be shown ", IsRequired=true, ParameterType="query")]
        public virtual Guid? CompanyId { get; set; }

        ///<summary>
        ///Enter the customer id you want to see the information for a customer. Only admins are allowed to see all customers on their company, users can only see their own customer info.
        ///</summary>
        [ApiMember(Description="Enter the customer id you want to see the information for a customer. Only admins are allowed to see all customers on their company, users can only see their own customer info.", ParameterType="query")]
        public virtual Guid? CustomerId { get; set; }

        ///<summary>
        ///Enter the user id you want to see the information for a customer. Only admins are allowed to see all customers on their company, users can only see their own customer info. User Id is the userprofile
        ///</summary>
        [ApiMember(Description="Enter the user id you want to see the information for a customer. Only admins are allowed to see all customers on their company, users can only see their own customer info. User Id is the userprofile", ParameterType="query")]
        public virtual Guid? UserId { get; set; }

        ///<summary>
        ///Will search by any customer name,phone or email that contains the searchstring provided.
        ///</summary>
        [ApiMember(Description="Will search by any customer name,phone or email that contains the searchstring provided.", ParameterType="query")]
        public virtual string Search { get; set; }

        ///<summary>
        ///If you want to filter on visible customers.
        ///</summary>
        [ApiMember(Description="If you want to filter on visible customers.", ParameterType="query")]
        public virtual bool? Visible { get; set; }

        ///<summary>
        ///If you want to include the connected custom fields
        ///</summary>
        [ApiMember(DataType="boolean", Description="If you want to include the connected custom fields", ParameterType="query")]
        public virtual bool IncludeCustomFieldValues { get; set; }

        ///<summary>
        ///If you want to include the connected custom fields
        ///</summary>
        [ApiMember(DataType="boolean", Description="If you want to include the connected custom fields", ParameterType="query")]
        public virtual bool IncludeCustomFields { get; set; }

        ///<summary>
        ///If you want to include the comments on the customer
        ///</summary>
        [ApiMember(DataType="boolean", Description="If you want to include the comments on the customer", ParameterType="query")]
        public virtual bool IncludeComments { get; set; }

        ///<summary>
        ///If you want to include the accesskeys
        ///</summary>
        [ApiMember(Description="If you want to include the accesskeys")]
        public virtual bool IncludeAccessKeys { get; set; }

        ///<summary>
        ///If you want to include invoice address
        ///</summary>
        [ApiMember(Description="If you want to include invoice address")]
        public virtual bool IncludeInvoiceAddress { get; set; }
    }

    public partial class CustomerQueryResponse
    {
        public CustomerQueryResponse()
        {
            CustomFields = new List<CustomFieldConfigData>{};
            CustomFieldValues = new List<CustomFieldDataResponse>{};
            Comments = new List<CustomerCommentsResponse>{};
            AccessKeys = new List<UserAccessKeys>{};
        }

        public virtual Guid Id { get; set; }
        public virtual string Firstname { get; set; }
        public virtual string Lastname { get; set; }
        public virtual string Email { get; set; }
        public virtual string Phone { get; set; }
        public virtual string ImageUrl { get; set; }
        public virtual List<CustomFieldConfigData> CustomFields { get; set; }
        public virtual List<CustomFieldDataResponse> CustomFieldValues { get; set; }
        public virtual List<CustomerCommentsResponse> Comments { get; set; }
        public virtual List<UserAccessKeys> AccessKeys { get; set; }
        public virtual DateTime Updated { get; set; }
        public virtual DateTime Created { get; set; }
        public virtual Object ResponseStatus { get; set; }
        public virtual bool SubscribedToNewsletter { get; set; }
        public virtual InvoiceAddress InvoiceAddress { get; set; }
    }

    public partial class CustomFieldConfigData
    {
        public CustomFieldConfigData()
        {
            Values = new List<CustomFieldValueResponse>{};
        }

        ///<summary>
        ///Custom field id
        ///</summary>
        [ApiMember(Description="Custom field id")]
        public virtual int Id { get; set; }

        ///<summary>
        ///Configuration name. Example: 'Number of persons'.
        ///</summary>
        [ApiMember(Description="Configuration name. Example: 'Number of persons'.")]
        public virtual string Name { get; set; }

        ///<summary>
        ///Custom field description. Example: 'For how many persons is this booking?'
        ///</summary>
        [ApiMember(Description="Custom field description. Example: 'For how many persons is this booking?'")]
        public virtual string Description { get; set; }

        ///<summary>
        ///Field width. Example: 20 for 20px
        ///</summary>
        [ApiMember(Description="Field width. Example: 20 for 20px")]
        public virtual int? Width { get; set; }

        ///<summary>
        ///Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'
        ///</summary>
        [ApiMember(Description="Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'")]
        public virtual string DataType { get; set; }

        ///<summary>
        ///Default value of the field. Example: '3'
        ///</summary>
        [ApiMember(Description="Default value of the field. Example: '3'")]
        public virtual string DefaultValue { get; set; }

        ///<summary>
        ///Determines if the field is required to have a value or not
        ///</summary>
        [ApiMember(Description="Determines if the field is required to have a value or not")]
        public virtual bool IsMandatory { get; set; }

        ///<summary>
        ///Error message shown to the user if the field data is required but not entered
        ///</summary>
        [ApiMember(Description="Error message shown to the user if the field data is required but not entered")]
        public virtual string MandatoryErrorMessage { get; set; }

        ///<summary>
        ///Max lenght of the field
        ///</summary>
        [ApiMember(Description="Max lenght of the field")]
        public virtual int MaxLength { get; set; }

        ///<summary>
        ///If the field should have multiple lines
        ///</summary>
        [ApiMember(Description="If the field should have multiple lines")]
        public virtual bool MultipleLineText { get; set; }

        ///<summary>
        ///Regular expression used for validation of the field
        ///</summary>
        [ApiMember(Description="Regular expression used for validation of the field")]
        public virtual string RegEx { get; set; }

        ///<summary>
        ///Error message shown if the regular expression validation failed
        ///</summary>
        [ApiMember(Description="Error message shown if the regular expression validation failed")]
        public virtual string RegExErrorMessage { get; set; }

        ///<summary>
        ///The values to select from if Datatype is DropDown for this custom field
        ///</summary>
        [ApiMember(Description="The values to select from if Datatype is DropDown for this custom field")]
        public virtual List<CustomFieldValueResponse> Values { get; set; }
    }

    public partial class CustomFieldDataResponse
    {
        public virtual int Id { get; set; }
        public virtual string Column { get; set; }
        public virtual string Name { get; set; }
        public virtual string Description { get; set; }
        public virtual string Value { get; set; }
        ///<summary>
        ///Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'
        ///</summary>
        [ApiMember(Description="Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'")]
        public virtual string DataType { get; set; }
    }

    public partial class CustomFieldValueResponse
    {
        public virtual string Value { get; set; }
    }

}

namespace PaysonIntegrationCO2.Models
{
    public partial class Customer
    {
        public virtual string City { get; set; }
        public virtual string CountryCode { get; set; }
        public virtual string IdentityNumber { get; set; }
        public virtual string Email { get; set; }
        public virtual string FirstName { get; set; }
        public virtual string LastName { get; set; }
        public virtual string Phone { get; set; }
        public virtual string PostalCode { get; set; }
        public virtual string Street { get; set; }
        public virtual string Reference { get; set; }
        public virtual CustomerType Type { get; set; }
    }

}