from dataclasses import dataclass, field

from .base import Paysite, Service_Post, Service_User


@dataclass
class User(Service_User):
    def profile(self, artist: dict) -> str:
        return f"https://www.patreon.com/user?u={(artist or {}).get('id')}"


@dataclass
class Post(Service_Post):
    def link(self, post_id: str, user_id: str) -> str:
        return f"https://www.patreon.com/posts/{post_id}"


@dataclass
class Patreon(Paysite):
    name: str = "patreon"
    user: User = field(default_factory=User)
    post: Post = field(default_factory=Post)
    title: str = "Patreon"
    color: str = "#fa5742"
