from ..endorsements.endorsement_header import generate_endorsement_page_header_text
from ...config import NEW_PAGE_TAG


@staticmethod
def generate_faq27a_endorsement_text() -> str:
    endorsement_header_text = generate_endorsement_page_header_text()
    text = (
        f"{endorsement_header_text}"
        "Quebec Endorsement Form\n"
        "Q.E.F. N 27a\n"
        "Civil liability resulting from damage caused to vehicles of which named insured is not owner\n"
        "(excluding vehicles provided by an employer)\n"
        "(Section A)\n"
        "The endorsement heading must be entered in the ''Declarations'' section of the insurance contract."
        "Details required for the endorsement may be entered in the ''Declarations'' section or in the endorsement"
        "itself, at the insurer's option.\n"
        "Name of insurer: \n"
        "Named insured: \n"
        "Endorsement to automobile insurance policy N:\n"
        "Effective date: This endorsement will apply from  at 12:01 A.M. "
        "standard time at the address of the named insured.\n"
        "Termination date: This endorsement will apply until   at 12:01 A.M. "
        "standard time at the address of the named insured or, if no date is specified, until "
        "the expiry date of the insurance contract.\n"
        "Additional insurance premium payable:\n"
        "\t Amount payable:  \n"
        "\t Due date:  \n"
        "Endorsement description\n"
        "This endorsement extends coverage under Section A of the insurance contract to the financial "
        "consequences that an insured person may incur when civilly liable for:\n"
        "\t damage caused to a vehicle of the  type or its equipment and accessories; and\n"
        "\t disappearance of the vehicle or its equipment and accessories.\n"
        "Civil liability may be contractual or extracontractual.\n"
        "Insured persons\n"
        "In this endorsement, ''insured person'' refers to:\n"
        "\t the named insured;\n"
        "\t his or her spouse;\n"
        "\t any person designated in a Q.E.F. N 2 entitled ''Vehicles of which named insured "
        "is not owner and when driven by named drivers'', attached to the insurance contract;\n"
        "\t the legal representatives and the succession of all the above listed insured persons.\n"
        f"{NEW_PAGE_TAG}\n"
        f"{endorsement_header_text}"
        "However, if the named insured is a legal person, partnership or association, "
        "''insured person'' refers to:\n"
        "\t any employee, shareholder, partner or member authorized by the named insured;\n"
        "\t their spouse;\n"
        "\t any person designated in a Q.E.F. N 2, attached to the insurance contract;\n"
        "\t the legal representatives and the succession of all the above listed insured persons.\n"
        "or solely:\n"
        "\t the following persons:  ;\n"
        "\t their spouse;\n"
        "\t any person designated in a Q.E.F. N 2, attached to the insurance contract;\n"
        "\t the legal representatives and the succession of all the above listed insured persons.\n"
        "Application\n"
        "1. The insured person must have the care, custody or control of the vehicle or its "
        "equipment and accessories.\n"
        "2. The insured person or anyone whose domicile is the same as that of the named insured "
        "must not be the owner of the vehicle or its lessee for at least one year or under a contract "
        "of leasing.\n"
        "3. The employer of an insured person or the employer of anyone whose domicile is the same as "
        "that of the named insured must not be the owner of the vehicle or its lessee for at least "
        "one year or under a contract of leasing.\n"
        "Covered perils and insurance premium\n"
        "Coverage is provided only for those perils for which a deductible or an insurance "
        "premium is shown in the table below, or entered specifically for this endorsement "
        "in the ''Declarations'' section of the insurance contract:\n"
        "SECTION A: Coverage for civil liability arising from property damage "
        "and bodily injury caused to another person\n"
        " PERILS | DEDUCTIBLE | INSURANCE PREMIUM\n"
        "Protection 1: ''All perils'', Protection 2: Perils of collision and upset, "
        "Protection 3: All perils other than collision or upset, "
        "Protection 4: Specific perils | Deductible per loss:: $ $ $ $ | $ $ $ $ \n"
        "  | Total : |  $"
        f"{NEW_PAGE_TAG}\n"
        f"{endorsement_header_text}"
        "Clarifications\n"
        "1. Protections 1, 2, 3 and 4 have the same meanings as in Section B of the "
        "insurance contract. The exclusions specified in that section will apply, as the case may be.\n"
        "2. An amount of insurance of  $ will apply per loss, plus expenses, costs and "
        "interest arising from a lawsuit.\n"
        "3. Where applicable, the additional coverage provided under Section A of "
        "the insurance contract may apply.\n"
        "4. The insurer agrees not to exercise any recourse against a person who, with "
        "the insured person's consent, has the care, custody or control of the vehicle or its "
        "equipment and accessories, unless that person:\n"
        "\t was engaged in a garage business at the time of the loss; or\n"
        "\t failed to comply with the insurance contract.\n"
        f"{NEW_PAGE_TAG}\n"
    )

    return text
