import { type TogilleAddress } from '../Client/RegisteredClients/Corporate'
import {
    type SorterInterface,
    type FilterInterface,
    type ListFrontEndInterface,
} from '../CommonType'

export interface InvoiceDetailsListDataTypeInterface extends InvoiceTableData {
    key: React.Key
}

export interface InvoiceDetailsListInterface {
    clientDropDownList: CorporateEntity[]
    userList: ListFrontEndInterface[]
    serviceDropDownList: ListFrontEndInterface[]
    paymentOptionList?: CorporateEntity[]
    paymentModeList?: ListFrontEndInterface[]
}

export interface BankDetailsFormInterface {
    onSave: (data: InvoiceFromData, callBack: CallableFunction) => void
    editData: InvoiceFromData
}

export interface BankDetailsExpandViewInterface {
    bankDetailsData: InvoiceDetailsListDataTypeInterface
}

export interface InvoiceDetailsPayloadInterface {
    data: InvoiceFromData[]
    noOfRecords: number
}
export interface InvoiceTableData {
    no: number
    invoiceId: number
    invoiceNo: string
    invoiceDate: string
    netTotal: number
    businessType: string
    clientName: string
    clientNumber: string
    isSent: number
    sentDate: string | null
    serviceProcessId: number
    isPaid: number
    paidDate: string
    paidRemarks: string
    lastCommunicationStatus: string
    lastCommunicationStatusURL: string
    currentStatus: string
    isStripePaid: number
    createdDate: string | null
    createdUser: string | null
    lastUpdateDate: string | null
    lastUpdateUser: string | null
    deletedDate: string | null
    deletedUser: string | null
}
export interface InvoiceDetail {
    invoiceId: number
    lineDescription: string
    quantity: number
    unitPrice: number
    grossTotal: number
    discountType: number
    discountValue: number
    discount: number
    totalAfterDiscount: number
    serviceId: number
    taxApplied: number
    tax: number
    netAmount: number
}

export interface InvoiceDetailView extends InvoiceDetail {
    invoiceDetailId: number
    serviceName: string
    description: string
}

export interface InvoiceFromData {
    invoiceId: number
    invoiceNo: string
    invoiceCategory: number
    businessType: number
    invoiceFor: number
    invoiceForDescription: string
    invoiceDate: string
    paymentDueDate: string
    total: number
    subTotal: number
    discountTotal: number
    taxTotal: number
    netTotal: number
    preparedBy: number
    paymentNotifyTo: number
    paidTo: number
    paidToDescription: string
    approvedBy: number
    invoiceStatus: number
    paymentModeId: number
    paymentOptionId: number
    remarks: string
    clientId: string
    clientName: string
    paymentOptionName: string
    acc_InvoiceDetailList: InvoiceDetail[]
    acc_InvoiceDetailViewList: InvoiceDetailView[]
    isSent: number
    sentDate: string
    serviceProcessId: number
    isPaid: number
    paidDate: string
    paidRemarks: string
    accountName: string
    accountNo: string
    branch: string
    swiftCode: string
    iban: string
}

export interface CorporateEntity {
    id: string
    identifier: string
    displayName: string
    displayImageURL: string
    additionalDataOne: string
    additionalDataTwo: string
    additionalDataThree: string
    additionalDataFour: string
    additionalDataFive: string
}
export interface PaidInvoiceProps {
    invoiceDetailsList: InvoiceDetailsListDataTypeInterface[]
    invoiceDetailsListCount: number
    activeButton: number
    searchData: AdvanceSearchInterface | null
    resetData: boolean
}

export interface PaidInvoiceSateProps {
    invoiceDetailsList: InvoiceDetailsListDataTypeInterface[]
    invoiceDetailsListCount: number
}

export interface CommunicationHistory {
    communicationHistoryId: number
    communicationTypeId: number
    invoiceId: number
    description: string
    historyDate: string
    contactNumber: string
}
export interface unPaidPhoneCallProps {
    serviceProcessId: number
    invoiceIds: number
    changePhoneCallModalStatus: () => void
}

export interface unPaidSMSProps {
    serviceProcessId: number
    invoiceIds: number
    changeSMSModalStatus: () => void
}

export interface unPaidmailProps {
    serviceProcessId?: number
    invoiceIds: number
    emailTemplateTypeList: ListFrontEndInterface[]
    changeMailModalStatus?: () => void
}

export interface unPaidmailStateProps {
    emailTemplateTypeList: ListFrontEndInterface[]
}

export interface ContactInfo {
    contactName: string
    contactNumber: string
    emailAddress: string
    alternativeEmailAddress: string
    bccEmailAddress: string
}

export interface InvoiceHistoryPayloadInterface {
    data: CommunicationHistory[]
    noOfRecords: number
}

export interface InvoiceListCommunicationHistory extends CommunicationHistory {
    key: React.Key
}
export interface InvoiceHistoryProps {
    seletedButton: number | null
    setButtonID: React.Dispatch<React.SetStateAction<number | null>>
    invoiceIds: number
    // changePhoneCallModalStatus: () => void
    invoiceHistoryList: InvoiceListCommunicationHistory[]
    invoiceHistoryListCount: number
}

export interface InvoiceHistorystateProps {
    invoiceHistoryList: InvoiceListCommunicationHistory[]
    invoiceHistoryListCount: number
}

export interface OptionList {
    value: string
    label: string
    id: string
    desc: React.ReactElement
}

export interface createInvoicePageProp {
    clientDropDownList: CorporateEntity[]
    userList: ListFrontEndInterface[]
    serviceDropDownList?: ListFrontEndInterface[]
    paymentOptionList?: CorporateEntity[]
    paymentModeList?: ListFrontEndInterface[]
}

export interface EdittableInterface {
    serviceDropDownList?: ListFrontEndInterface[]
    invoiceBodyList?: InvoiceBody[]
    editstatus?: boolean
    setTaxTotal: React.Dispatch<React.SetStateAction<number>>
    setSubTotal: React.Dispatch<React.SetStateAction<number>>
    setDiscount: React.Dispatch<React.SetStateAction<number>>
    setNetTotal: React.Dispatch<React.SetStateAction<number>>
    setTabledata: React.Dispatch<React.SetStateAction<InvoiceBody[]>>
}
export interface EdittableStateInterface {
    serviceDropDownList: ListFrontEndInterface[]
}

export interface comStatusPainInvoivc {
    invoiceIds: number
    changePaidModalStatus: () => void
}
export interface paidInvoice {
    invoiceId: number
    paidDate: string
    paidRemarks: string
}

export interface BusinessDocumentTemplate {
    companyName: string
    addressOne: string
    addressTwo: string
    town: string
    country: string
    postCode: string
    companyLogo: string
    signatureLogo: string
    rubberStampLogo: string
    additionalImage: string
    homeNo: string
    workNo: string
    mobileNo: string
    emailAddress: string
    website: string
    documentFooterText: string
}
export interface InvoiceBodyList extends InvoiceBody {
    key: string
}
export interface InvoiceBody {
    invoiceDetailId: number
    invoiceId: number
    lineDescription: string
    quantity: number
    unitPrice: number
    grossTotal: number
    discountType: number
    discountValue: number
    discount: number
    totalAfterDiscount: number
    serviceName: string
    taxApplied: number
    tax: number
    netAmount: number
    description: string
}

export interface InvoiceHeader {
    invoiceId: number
    invoiceNo: string
    invoiceCategory: string
    businessType: string
    invoiceFor: number
    invoiceForDescription: string
    invoiceDate: string
    paymentDueDate: string
    total: number
    subTotal: number
    discountTotal: number
    taxTotal: number
    netTotal: number
    preparedBy: string
    paymentNotifyTo: number
    paidTo: string
    paidToDescription: string
    approvedBy: string
    invoiceStatus: string
    paymentModeName: string
    paymentOptionName: string
    remarks: string
    clientId: any
    clientName: string
    invoiceBodyList: InvoiceBody[]
    accountName: string
    accountNo: string
    branch: string
    swiftCode: string
    iban: string
}

export interface InvoiceContactDetail {
    contactName: string
    preferredName: string
    contactNumber: string
    attentionEmail: string
    attentionAltEmail: string
}

export interface Email {
    clientEmailId: number
    templateId: number
    serviceProcessId: number
    companyTypeId: number
    referenceId: number
    serviceActionId: number
    serviceActionStepId: number
    fromAddress: string
    toAddress: string
    ccAddress: string
    bccAddress: string
    subject: string
    description: string
    emailStatus: string
    serviceId: number
    contactName: string
    invoiceId: number
}
export interface EmailDetails {
    clientEmailId: number
    templateId: number
    invoiceId: number
    companyTypeId: number
    referenceId: number
    serviceActionId: number
    serviceActionStepId: number
    fromAddress: string
    toAddress: string
    ccAddress: string
    bccAddress: string
    subject: string
    description: string
    emailStatus: string
    serviceId: number
    fromName: string
    clientEmailTypeId: number
    uniqueCode: string
    attachmentStringId: string | null
}

export interface AdvanceSearchInterface {
    searchCriteriaList: FilterInterface[] | []
    sortOrderList?: SorterInterface[] | []
}

export interface InvoiceTabledata {
    lineDescription: string
    grossTotal: number
    discountType: number
    discountValue: number
    discount: number
    totalAfterDiscount: number
    serviceName: string
    taxApplied: number
    tax: number
    netAmount: number
}

export interface InvoiceEmailData {
    invoiceId: number
    templateId: number
    contactName: string
    fromAddress: string
    toAddress: string
    ccAddress: string
    bccAddress: string
    subject: string
    description: string
    invoicePath: string
    serviceProcessId: number
    businessTypeId: number
    referenceId: number
    invoiceRemarks: string
    serviceDescription: string
    uniqueCode: string
}

export interface ClientAttachment {
    clientAttachmentId: number
    clientEmailId: number
    attachmentPath: string
    uniqueCode: string
}

export interface AddressPayloadIntrfaceData {
    data: TogilleAddress
}
