File size: 2,045 Bytes
317211f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6d9df31
317211f
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# generated by datamodel-codegen:
#   filename:  schema.json
#   timestamp: 2023-07-28T11:36:16+00:00

from __future__ import annotations

from datetime import datetime

from pydantic import BaseModel, Field, constr, validator, ValidationError


class BankDetails(BaseModel):
    """account holder name, bank name, account number, branch, ifs code, swift code"""

    account_holder_name: str = Field(..., title="The name of the account holder")
    bank_name: str = Field(..., title="The name of the bank")
    account_number: str = Field(..., title="The account number")
    branch: str = Field(..., title="The branch of the bank")
    ifs_code: str = Field(..., title="The IFS code of the bank")
    swift_code: str = Field(..., title="The SWIFT code of the bank")


class InformationExtractedFromABillReceipt(BaseModel):
    """
    GSTIN, billing address, invoice number, invoice date, due date, total, balance due,
    bank details: (account holder name, bank name, account number, branch, ifs code, swift
    code), recipient, registration id, registration fee, registration date/time
    """

    gstin: constr(min_length=15) = Field(
        ..., title="The alphanumeric GSTIN/GST number code"
    )
    billing_address: str = Field(..., title="The billing address")
    uids: str = Field(..., title="The invoice number")
    invoice_date: datetime = Field(..., title="The date-time the invoice was issued")
    due_date: datetime = Field(..., title="The date-time the invoice is due")
    total: float = Field(..., title="Total amount or price")
    balance_due: float = Field(..., title="The amount due")
    bank_details: BankDetails = Field(..., title="Bank details")
    recipient: str = Field(
        ...,
        title="Name of the person/entity that the invoice item was charged or delivered to",
    )
    registration_id: str = Field(..., title="The registration ID")
    registration_fee: float = Field(..., title="The registration fee")
    registration_date_time: datetime = Field(..., title="The registration date-time")