import base64
import datetime

import pytest

from csirtmu.beta_temporal.external_services.alpha.structs import AccountingRecord


def xml() -> str:
    return """<?xml version="1.0" encoding="UTF-8"?>
<Infringement xmlns="http://www.acns.net/ACNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.acns.net/ACNS http://www.acns.net/v1.2/ACNS2v1_2.xsd">
<Case>
<ID>111111111111111111</ID>
<Status>Open</Status>
<Severity>Normal</Severity>
</Case>
<Complainant>
<Entity>Paramount Pictures Corporation</Entity>
<Contact>Vobile - Compliance</Contact>
<Address>2880 Lakeside Drive, Suite 200
Santa Clara, CA 95054</Address>
<Phone>+1 (408) 492 1100</Phone>
<Email>p2p@copyright-notice.com</Email>
</Complainant>
<Service_Provider>
<Entity>CESNET z.s.p.o.</Entity>
<Email>abuse@muni.cz</Email>
</Service_Provider>
<Source>
<TimeStamp>2020-11-11T12:14:20Z</TimeStamp>
<IP_Address>147.251.163.172</IP_Address>
<Port>54662</Port>
<Type>BitTorrent</Type>
<SubType BaseType="P2P" Protocol="BITTORRENT"/>
<Number_Files>1</Number_Files>
</Source>
<Content>
<Item>
<TimeStamp>2020-11-11T12:14:20Z</TimeStamp>
<Title>The Naked Gun: From the Files of Police Squad!</Title>
<FileName>The.Naked.Gun.From.the.Files.of.Police.Squad.1988.720p.BluRay.x264.AAC-ETRG</FileName>
<FileSize>700489810</FileSize>
<Hash Type="SHA1">111111111111111111111111111111111111111111</Hash>
</Item>
</Content>
</Infringement>"""


@pytest.fixture
def xml_attachment() -> str:
    return base64.b64encode(xml().encode("utf-8")).decode("utf-8")


@pytest.fixture
def xml_body() -> str:
    return "Start ACNS XML\n" + xml() + "\nEnd ACNS XML"


@pytest.fixture
def uco_culprit() -> AccountingRecord:
    return AccountingRecord(
        start_time=datetime.datetime(year=2024, month=1, day=1, tzinfo=datetime.UTC),
        username="123456@muni.cz",
    )


@pytest.fixture
def mail_culprit() -> AccountingRecord:
    return AccountingRecord(
        start_time=datetime.datetime(year=2024, month=1, day=1, tzinfo=datetime.UTC),
        username="mail@test.com",
    )
